fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int a =1;
  6. int sum =0;
  7. while(a<=100)
  8. {
  9. if(a%3!=0&&a%5!=0)
  10. {
  11. sum=sum+a;
  12. }
  13. a=a+1;
  14. }
  15. printf("3の倍数でもなく、5の倍数でもない数字の和は%dです\n",sum);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
3の倍数でもなく、5の倍数でもない数字の和は2632です