fork download
  1. #include <stdio.h>
  2. int main(void) {
  3. int a=1,n=0,b;
  4.  
  5. while( a<=100 ) {
  6. b=a%10;
  7. if(a%3==0 ||a%5==0 ||b<=5)
  8. a=a+1;
  9. printf("%d",a);
  10. else
  11. { n=n+a;
  12. a=a+1;}
  13. }
  14.  
  15. printf("和の合計は%dです。\n",n);
  16. return 0;
  17. }
  18.  
Compilation error #stdin compilation error #stdout 0s 5300KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:7:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if(a%3==0 ||a%5==0 ||b<=5)
     ^~
prog.c:9:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      printf("%d",a);
      ^~~~~~
prog.c:10:5: error: ‘else’ without a previous ‘if’
     else
     ^~~~
stdout
Standard output is empty