Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- int i,n,flag=0;
- scanf("%d",&n);
- for(i=2; i<=sqrt(n);i++)
- {
- if(n%i==0)
- {
- flag==1; //flag+=1
- break;
- }
- }
- if(flag==0)
- {
- printf("%d is prime number\n",n);
- }
- else
- {
- printf("%d is not prime number\n",n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement