C++ : generate the following output

* * * * *
* * * *
* * *
* *
*  


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

using namespace std;

int main()
{
int n=5;
for(int i=1;i<=5;i++)
{
for(int j=n;j>=1;j--)
{
cout<<"*";
}
n--;
cout<<"\n";

}
getch();
return(0);
}

No comments:

Post a Comment