English, asked by zjgjv, 1 year ago

write a prgrm to check a no is prime or not.​

Answers

Answered by Anonymous
2

hope it helps u. . . . . . . .

Attachments:
Answered by Rajputsaurabhsingh
0

________#£¥________

Example: Program to Check Prime NumberEnter a positive integer: 29 29 is a prime number. If the for loop terminates when the test expression of loop i <= n/2 is false, the entered number is a prime number. The value of flag is equal to 0 in this case......

If the number entered by user is perfectly divisible by i then, isPrime is set to false and the number will not be a prime number. But, if the number is not perfectly divisible by i until test condition i <= n/2 is true means, it is only divisible by 1 and that number itself. So, the given number is a prime number.

Similar questions