fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x;
  5. scanf("%d",&x);
  6.  
  7. if (x%2==0)
  8. {
  9. printf("素数ではない");
  10. }
  11. else if (x%5==0)
  12. {
  13. printf("素数ではない");
  14.  
  15. }
  16. else if (x%3==0)
  17. {
  18. printf("素数ではない");
  19. }
  20. else if (x%7==0)
  21. {
  22. printf("素数ではない");
  23. }
  24. else if (x==1)
  25. {
  26. printf("素数ではない");
  27. }
  28. else {
  29. printf("素数です");
  30. }
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.01s 5296KB
stdin
1
stdout
素数ではない