New Pattern in Turbo C++ must try (For Students of XI & XII - CBSE)

//New Pattern in Turbo C++ must try (For Students of XI & XII - CBSE)

#include<iostream.h>

#include<conio.h>
#include<iomanip.h>

void main()

{
int i,j,n;
clrscr();
cout<<"Enter Number :";
cin>>n;
for(i=1;i<=n*3;i++)
{
for(j=1;j<=n*2;j++)
{
if(i+j<=n*2)
{
cout<<"  ";
}
else if(i<=n && i+j>=n*2+1 || i>=n && j<=n && i+j>=n*2+1 || j>=n && i+j>=n*3+1)
{
cout<<setw(4)<<"*";
}
else
{
cout<<"    ";
}
}
cout<<endl;
}
getch();
}

/*

Output:

















*/

No comments

Post your comments

Powered by Blogger.