fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a=1;
  5. int b=0;
  6.  
  7.  
  8. while( a<=100 )
  9. {
  10. if((a%3!=0)&&(a%5!=0)){
  11. if(a%10>=6)
  12. {
  13. b = b + a;}
  14. }
  15. a = a + 1;
  16. }
  17.  
  18. printf("1から100のうち3の倍数でもなく、5の倍数でもない数字の中で、1の位の数字が6以上のものの合計は%dです。 \n", b);
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
1から100のうち3の倍数でもなく、5の倍数でもない数字の中で、1の位の数字が6以上のものの合計は1365です。