May 24, 2008

C++ Program for Pyramid of Stars (Upside down and Centered Aligned)














#include<iostream.h>
#include<conio.h>

main()
{
clrscr();
int j=1;
for (int i=5;i>=1;i--)
{
for (int k=1;k<=j;k++)
{
cout << " ";
}
for (int x=1;x<=i;x++)
{
cout << " *";
}
cout <<endl;
j=j+1;
}
getch();
}

No comments:

Post a Comment

Infolinks In Text Ads

Total Pageviews

Powered by Blogger.

Dont Forget To Follow Us