Miti059

5.To check wether a number is prime number or not

Jun 23rd, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.21 KB | None | 0 0
  1. #include<stdio.h>
  2. main()
  3. {
  4. int i,n,c=0;
  5. scanf("%d",&n);
  6. for(i=1;i<=n;i++)
  7. {
  8.  if(n%i==0)
  9. c++;
  10. }
  11. if(c==2)
  12.     printf("prime numbers:");
  13.     else
  14.     printf("not a prime numbers");
  15.     return 0;
  16. }
Add Comment
Please, Sign In to add comment