Computer Science, asked by asrafulpaao, 6 months ago

WAP to input a number and check if it is prime.
pls help.​

Answers

Answered by nihalbisht08
3

Answer:

If any number smaller than the given number divides it then it is not Prime number. Otherwise, it is a prime number. Let's take an example of two numbers and check whether they are prime or not using this process. Logic − We will divide 42 by every number greater than 1 and smaller than 42

Explanation:

Answered by lakshmanmaiti31
1

Answer:

Program to Check Prime Number

In the program, a for loop is iterated from i = 2 to i < n/2 . If n is perfectly divisible by i , n is not a prime number. In this case, flag is set to 1, and the loop is terminated using the break statement. After the loop, if n is a prime number, flag will still be 0.

Explanation:

please follow me.

Similar questions