Advertisement
afrinahoque

Whether a number is Prime number or not

Jun 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i, n, count=0;
  5.     printf("Enter the number:");
  6.     scanf("%d", &n);
  7.     for(i=2; i<n; i++)
  8.     {
  9.         if (n%i==0)
  10.         {
  11.             count=count+1;
  12.             break;
  13.         }
  14.     }
  15.     if (count==0)
  16.         printf("It's a Prime Number\n");
  17.     else
  18.         printf("It's not a Prime Number\n");
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement