Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. int x;
  6. int i,num,count = 0;
  7. printf("enter the number(only apositive integer):");
  8. scanf("%d",&num);
  9. for(i=2;i<=num;i++)
  10. {
  11. if(num%i==0)
  12. {
  13. count++;
  14. break;
  15. }
  16.  
  17. }
  18. if(count==0)
  19. printf("%d is a prime number",num);
  20. else
  21. printf("%d is not a prime number",num);
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement