Today we will study program for Pattern of stars* in C++
#include<iostream.h>
#include<conio.h>void main()
{
clrscr();
int i,j,k;
for(i=1;i<=3;i++)
{
for(j=3;j>i;j--)
{
cout<<" ";
}
for(k=1;k<=2*i-1;k++)
{
cout<<"*";
}
cout<<endl;
}
for(i=2;i>=1;i--)
{
for(j=2;j>=i;j--)
{
cout<<" ";
}
for(k=1;k<=2*i-1;k++)
{
cout<<"*";
}
cout<<endl;
}
getch();
}
0 comments:
Post a Comment