Advertisement
Guest User

zbrojiti visekratnike

a guest
Mar 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int brojac=1;
  7.     int zbroj=0;
  8.    
  9.     while(brojac<1001)
  10.     {
  11.         if( (brojac %3 ==0) || (brojac % 5 ==0))
  12.         {
  13.             zbroj=zbroj+brojac;
  14.         }
  15.        
  16.         brojac++;
  17.     }
  18.    
  19.     cout<<zbroj<<endl;
  20.    
  21.     system("pause");
  22.    
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement