Advertisement
pablo7890

Untitled

Feb 24th, 2013
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main () {
  4.     int k, n, s=0;
  5.     cin >> k;
  6.     for (int i=0; i<k; i++) {
  7.         cin >> n;
  8.         for (int j=0; j<=n; j++) {
  9.             if (j%5==0) {
  10.                 s = s+j;
  11.             } else if (j%3==0) {
  12.                 s = s+j;
  13.             }
  14.         }
  15.         cout << s;
  16.         s = 0;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement