fork(1) download
  1. #include<stdio.h>
  2. int main(){
  3. int ans,judge,loop;
  4. printf("値を分析します\n好きな数字を入力してください。\n");
  5. scanf("%d",&ans);
  6. ans%2=judge;
  7. if(judge=0){
  8. printf("偶数です\n");
  9. }else{
  10. printf("奇数です\n");
  11. }
  12. for(loop=1;loop<ans;loop++){
  13. ans%loop=judge;
  14. if(judge=0){
  15. printf("素数ではありません。\n");
  16. ans=loop;
  17. return 0;
  18. }
  19. }
  20. printf("素数です。\n");
  21. return 0;
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:6:6: error: lvalue required as left operand of assignment
 ans%2=judge;
      ^
prog.c:7:1: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
 if(judge=0){
 ^~
prog.c:13:9: error: lvalue required as left operand of assignment
 ans%loop=judge;
         ^
prog.c:14:1: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
 if(judge=0){
 ^~
stdout
Standard output is empty