Sunday, 12 July 2015

Solution Of 4th question

#include<iostream.h>
#include<conio.h>
using namespace std;
int main()
{
    int i,j,k,num;
    cout<<"Enter Number : ";
    cin>>num;
    for(i=1;i>=num;i++)
    {
    for(j=1;j<=1;j++)
    {
    cout<<" * ";
    }
    for(k=1;k<2*(num-1);k++)
    {
    cout<<" ";
    }
                         
    for(j=1;j<=1;j++)
    {
      if(i==num&&j==num)
      {
           cout<<"";
      }
      else
      {
          cout<<" * ";
      }
      }              
    cout<<endl;
    }
    getch();
}

No comments:

Post a Comment