fork download
  1. #include <stdio.h>
  2. int nai();
  3. int main()
  4. {
  5. int i;
  6. int sosu;
  7.  
  8. printf ("数字を入力");
  9. scanf ("%d\n",&sosu);
  10.  
  11. if ( sosu > 2 && sosu % 2 ==1)
  12. /*sosuが2以上、かつsosuが奇数の時ループ実行*/
  13. for (i=3;;i + 2)
  14. {
  15. if (sosu % i == 0)
  16. break;
  17. /*iで素数を割り切れたらループ終了*/
  18. }
  19. if (sosu == 1)
  20. int nai() ;
  21. if (sosu == 2)
  22. printf (" 素数") ;
  23. if (sosu % 2 == 0)
  24. int nai();
  25. if (i ==sosu)
  26. printf ("素数");
  27. return 0;
  28. }
  29. int nai()
  30. {
  31. printf("素数ではない");
  32. return 0;
  33. }
  34.  
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5
compilation info
prog.c: In function 'main':
prog.c:13:3: warning: statement with no effect [-Wunused-value]
   for (i=3;;i + 2)
   ^
prog.c:20:12: error: expected expression before 'int'
            int nai() ;
            ^
prog.c:24:3: error: expected expression before 'int'
   int nai();
   ^
stdout
Standard output is empty