Advertisement
ZinedinZidan

un

Oct 20th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5.  
  6.   int i,n,flag=0;
  7.   scanf("%d",&n);
  8.   for(i=2; i<=sqrt(n);i++)
  9.   {
  10.       if(n%i==0)
  11.       {
  12.           flag==1; //flag+=1
  13.           break;
  14.       }
  15.   }
  16.  
  17.   if(flag==0)
  18.   {
  19.       printf("%d is prime number\n",n);
  20.   }
  21.   else
  22.   {
  23.       printf("%d is not prime number\n",n);
  24.   }
  25.  
  26.  
  27.   return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement