Advertisement
Schknheit

Project Euler 1Q

Dec 12th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.    
  7.     int j = 0;
  8.    
  9.     for(int i = 1; i < 1000; ++i){
  10.         if(i % 3 == 0 || i % 5 == 0){
  11.             cout << i << endl; 
  12.             j = j + i;
  13.         }
  14.     }
  15.    
  16.     cout << "\n" << j << endl;
  17.        
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement