Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main () {
- int k, n, s=0;
- cin >> k;
- for (int i=0; i<k; i++) {
- cin >> n;
- for (int j=0; j<=n; j++) {
- if (j%5==0) {
- s = s+j;
- } else if (j%3==0) {
- s = s+j;
- }
- }
- cout << s;
- s = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement