fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a,b,s;
  5. a=1;
  6. b=a%3;
  7. s=0;
  8. while(a<=100)
  9. {switch(b)
  10. {case 0:
  11. s=s;
  12. break;
  13. case 1:
  14. case 2:
  15. if(a%10>=6)
  16. s=s+a;
  17. else
  18. s=s;
  19. break;
  20.  
  21. }
  22. a=a+1;
  23. b=a%3;
  24. }
  25. printf("1から100のうち,3の倍数でもなく, 5の倍数でもない数字の中で,1の位の数字が6以上のものの和は%dである。\n",s);
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
1から100のうち,3の倍数でもなく, 5の倍数でもない数字の中で,1の位の数字が6以上のものの和は1365である。