#include <stdio.h>
int multiples(void);
int main(void)
{
int mults = 0;
mults = multiples();
return 0;
}
int multiples(void)
{
int cnt, mult = 0, answer = 0;
for(cnt=0;cnt<1000;cnt++)
{
if( cnt%3 == 0 || cnt%5 == 0)
{
mult += cnt;
}
else if( cnt % 3 == 0 && cnt % 5 == 0)
{
mult += cnt;
}
}
answer = mult;
return answer;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBtdWx0aXBsZXModm9pZCk7CgppbnQgbWFpbih2b2lkKQp7CmludCBtdWx0cyA9IDA7CQptdWx0cyA9IG11bHRpcGxlcygpOwpwcmludGYoIiVkIiwgbXVsdHMpOwpyZXR1cm4gMDsKfQoKaW50IG11bHRpcGxlcyh2b2lkKQp7CmludCBjbnQsIG11bHQgPSAwLCBhbnN3ZXIgPSAwOwogICBmb3IoY250PTA7Y250PDEwMDA7Y250KyspCiAgIHsKICAgICAgaWYoIGNudCUzID09IDAgfHwgY250JTUgPT0gMCkKICAgICAgewogICAgICBtdWx0ICs9IGNudDsKICAgICAgfQogICAgICBlbHNlIGlmKCBjbnQgJSAzID09IDAgJiYgY250ICUgNSA9PSAwKQogICAgICB7CiAgICAgIG11bHQgKz0gY250OwogICAgICB9CiB9CmFuc3dlciA9IG11bHQ7CnJldHVybiBhbnN3ZXI7Cn0K