fork download
  1. #include <stdio.h>
  2. int isprime(int n);
  3. int main()
  4. {
  5. int n;
  6. printf ("enter the no.\n");
  7. scanf ("%d",&n);
  8. if (isprime(n)==1)
  9. printf("no. is prime");
  10. else
  11. printf("no. is not prime");
  12. return 0;
  13. }
  14. int (isprime(int n))
  15. {
  16. int i;
  17. for (i=2;i<n/2;i++)
  18. {
  19. if (n%i==0)
  20. return 0;
  21. else
  22. return 1;
  23. }
  24. }
Success #stdin #stdout 0s 9424KB
stdin
8
stdout
enter the no.
no. is not prime