Write a program to find whether a number input by user is prime or not.
Answers
Answered by
0
Answer:
Program to Check Prime Number
Program to Check Prime NumberEnter 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.
Hope it helps you!
Answered by
3
Answer:
Program to Check Prime Number
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