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