fork download
  1.  
  2. #include <stdio.h>
  3.  
  4. int main(void) {
  5. int i,n;
  6. scanf("%d",&n);
  7.  
  8. if (n <= 1){
  9. printf("素数ではない。/n");
  10. return 0;
  11. }
  12. for(i = 2; i <= n/2; i++){
  13. if(n % i == 0){
  14. printf("素数ではない。");
  15. return 0;
  16. }
  17. }
  18. printf("nは素数である。");
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
素数ではない。