Advertisement
RIFATKHAN1

check whether a number is Prime number or not.

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