Monday 14 January 2013

Let Us C Chapter 3 problem No: E-f


//Design

#include<iostream>
#include<windows.h>

using namespace std;

int main(void)
{
    int i,j,k,x,c,y;
    char xx,yy,kk;

    for(i=0;i<7;i++)
    {
         x=65;y=71-i;

        for(j=i;j<7;j++)
        {
            xx=x;
            cout.width(2);
            cout<<xx;
            x++;
        }

        for(k=1;k<(2*i);k++)
        {
           cout.width(2);
            cout<<" ";

        }

         if(i==0)
         {
             for(k=70;k>=65;k--)
             {
                 kk=k;
                 cout.width(2);
                cout<<kk;
             }

         }
        else
        {
        for(j=7;j>i;j--)
        {
            yy=y;
            cout.width(2);
            cout<<yy;
            y--;
        }
        }
        cout<<endl;
    }
}

No comments:

Post a Comment

Comments please: