Don't like ads? PRO users don't see any ads ;-)
Guest

zap0

By: a guest on Jun 17th, 2012  |  syntax: C++  |  size: 0.33 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.  for (int i=1;i<9;i++)
  9.  {
  10.         cout<<" ";
  11.        static int j=0;
  12.         if (i==1 || (i%2==0)){
  13.                 if (i!=1) cout<<i;      //print i before j
  14.                 cout<<" "<<j--<<" ";
  15.                 if (i==1) cout<<i;      //print i after j
  16.                 continue;       //skip this loop
  17.         }
  18.         cout<<i;
  19.        
  20.        
  21.  }
  22.         cout<<endl;
  23.         return 0;
  24. }