fork download
  1. //手計算で求めた解と等しくなったので正常に動いている
  2. #include <stdio.h>
  3.  
  4. int main(void) {
  5. // your code goes here
  6. int a=1,b=0;
  7. while(a<=100)
  8. {
  9. a=a+1;
  10. if(a%3!=0 && a%5!=0 && a%10>=6)
  11. b=b+a;
  12. }
  13.  
  14.  
  15. printf("1から100のうち,3の倍数でもなく, 5の倍数でもない数字の中で,1の位の数字が6以上のものの和は%d",b);
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
1から100のうち,3の倍数でもなく, 5の倍数でもない数字の中で,1の位の数字が6以上のものの和は1365