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