You are viewing a single comment's thread. Return to all comments →
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; } }
cout<<sum<<endl; } time limit problem in this program ,help to solve the problem hgdshfhs
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 →
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; } }