1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Difficult C programs

Discussion in 'C++' started by aijaz, Apr 14, 2008.

  1. sayedbd2015

    sayedbd2015 New Member

    Joined:
    Jan 20, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Ans (2)
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
      for(int i=1;i<=4;i++)
      {
          int k,l;
          k=l=0;
          for(int j=1;j<=i;j++)
          {
              k++;
             cout<<k;
              l++;
              if(l==i)
              {
                  while(k!=1)
                  {
                     k--;
                    cout<<k;
                  }
              }
        }
          cout<<endl;
      }
      return 0;
    }
     

Share This Page