Advertisement
AchkataJo

Untitled

Nov 21st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. int is_prime(int x)
  2. {
  3. int i,c = 0;
  4. for (i = 1; i <= x; i++)
  5. {
  6. if (x % i == 0)
  7. {
  8. c++;
  9. }
  10. }
  11.  
  12. if (c == 2) {
  13. printf("%d is a Prime number.",x);
  14. }
  15. else {
  16. printf("%d is not a Prime number.",x);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement