You are viewing a single comment's thread. Return to all comments →
Help me, my code does not the test 2 and test 3 due to a time error.
int main(){ int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int n; int addition = 0; cin >> n; for (int i = 0; i<n; i++) { if (i % 3 == 0 || i % 5 == 0) { addition += i; } } cout << addition << "\n"; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #1: Multiples of 3 and 5
You are viewing a single comment's thread. Return to all comments →
Help me, my code does not the test 2 and test 3 due to a time error.