alaminrifat

URI -1070 with C++

Apr 7th, 2020
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin>>n;
  9.  
  10.     //if user input odd number
  11.     if(n%2==1)
  12.     {
  13.         for(int i = 1; i <= 6;i++)
  14.         {
  15.             cout<<n<<endl;
  16.             n +=2;
  17.         }
  18.     }
  19.  
  20.     //if user input even number
  21.     else if(n%2==0)
  22.     {
  23.         n = n+1;
  24.         for(int i =1 ; i<=6 ; i++)
  25.         {
  26.             cout<<n<<endl;
  27.             n += 2;
  28.         }
  29.     }
  30. }
  31.  
  32. //visit http://codesolu.rf.gd for more
  33. //thank you
Advertisement
Add Comment
Please, Sign In to add comment