You are viewing a single comment's thread. Return to all comments →
Hi,
below is my code, which is failing even for t = 100.
I calculated manually for t = 100, but my answer(my answer 2633 vs system answer) seems correct.
can someone tell me whats wrong?
//Return sum of multiples of 3 and 5 below limitNum(n) int sumOfMultiples(int& limitNum) { int sum = 0; int num = 3;
for(int i =0; i<2; i++) { int tempLimitNum = limitNum -1; int reminder = 1; while(reminder != 0) { reminder = tempLimitNum % num; if(reminder != 0) { tempLimitNum--; } } sum =sum + (((tempLimitNum - num)/num)+1)*(0.5)*(num+num*(((tempLimitNum - num)/num)+1)); num = 5; } return sum;
}
Project Euler #1: Multiples of 3 and 5
You are viewing a single comment's thread. Return to all comments →
Hi,
below is my code, which is failing even for t = 100.
I calculated manually for t = 100, but my answer(my answer 2633 vs system answer) seems correct.
can someone tell me whats wrong?
//Return sum of multiples of 3 and 5 below limitNum(n) int sumOfMultiples(int& limitNum) { int sum = 0; int num = 3;
}