We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #1: Multiples of 3 and 5
Project Euler #1: Multiples of 3 and 5
Sort by
recency
|
1448 Discussions
|
Please Login in order to post a comment
I cannot pass 2 of the tests with this Kotlin code, anybody has any idea?
int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int sum =0; int n; cin >> n; for(int i = 3; i < n; i++){ if(i%3==0 || i%5==0){ sum+=i; } }
int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int sum =0; int n; cin >> n; for(int i = 3; i < n; i++){ if(i%3==0 || i%5==0){ sum+=i; } }
JAVA 8: Used sum of natural formula for calculation