completed multiples of 3 and 5

This commit is contained in:
aj 2019-02-08 18:53:34 +00:00
commit 5f6255e6e2

View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main(void){
int upperbound = 1000;
int total = 0;
int i;
for(i = 0; i < upperbound; i++)
if(i % 3 == 0 || i % 5 == 0)
total += i;
printf("the total of all multiples of 3 and 5 up to %i is %i\n", upperbound, total);
}