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