C++ Program for inverted Arrow Shape or Pyramid

Program Code:

#include<iostream>

using namespace std;
int main()
{
int a=3 ,b=0 ;
for(int s=0;s<5;s++)
{
for(int t=0;t<=a;t++)
cout<<" ";
for(int u=0;u<=s;u++)
cout<<"*";
a--;
cout<<endl;
}
for(int i=0;i<4;i++)
{
for(int j=0;j<=i;j++)
cout<<" ";
for(int k=b;k<4;k++)
cout<<"*";
b++;
cout<<endl;
}
return 0;
}

Output:

.exe file

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.