write a program to enter a number and check whether if is a prime number or not
Answers
Answered by
0
a program to enter a number and check whether if is a prime number or not
Answered by
1
Answer:
Enter a positive integer: 29 29 is a 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.
Similar questions