1
0

c5-9-2.c 295 B

1234567891011121314
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {int n,i,k;
  5. printf("please enter a integer number:n=?");
  6. scanf("%d",&n);
  7. k=sqrt(n);
  8. for (i=2;i<=k;i++)
  9. if(n%i==0) break;
  10. if(i<=k)
  11. printf("%d is not a prime number.\n",n);
  12. else printf("%d is a prime number.\n",n);
  13. return 0;
  14. }