Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- for (int i=1;i<9;i++)
- {
- cout<<" ";
- static int j=0;
- if (i==1 || (i%2==0)){
- if (i!=1) cout<<i; //print i before j
- cout<<" "<<j--<<" ";
- if (i==1) cout<<i; //print i after j
- continue; //skip this loop
- }
- cout<<i;
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment