Guest User

Untitled

a guest
Dec 10th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n=1;
  7.    
  8.  
  9.     while (n <=100)
  10.     {
  11.         cout<< n << endl;
  12.         n++;
  13.  
  14.         if(n%3 == 0 && n%5 == 0)
  15.         {
  16.             cout<<"fizzbuzz" <<endl;
  17.             n++;
  18.         }
  19.  
  20.         if(n%3 ==0)
  21.         {
  22.             cout<<"fizz" <<endl;
  23.             n++;
  24.         }
  25.  
  26.         if(n%5==0)
  27.         {
  28.             cout<<"buzz"<<endl;
  29.             n++;
  30.         }
  31.  
  32.        
  33.        
  34.     }
  35.  
  36.     cout<<endl;
  37.     system("PAUSE");
  38.     return 0;
  39. }
Add Comment
Please, Sign In to add comment