Practice Learning Problems for C89
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
177B

  1. #include <stdio.h>
  2. int main(void){
  3. int i = 0;
  4. int sum = 0;
  5. int max = 15;
  6. for (i=1;i<=max;i++){
  7. if (i%3 == 0 || i%5 == 0){
  8. sum = sum + i;
  9. }
  10. }
  11. printf("%d\n", sum);
  12. return 1;
  13. }