Program Code:
#include<iostream>
using namespace std;
int main()
{
int a=10 ,b =9 ;
for(int i =1;i<=10;i++)
{
for(int j =1;j<=a;j++)
{
cout<<" ";
}
for(int k=1;k<=i;k++)
{
cout<<"*";
cout<<" ";
}
a--;
cout<<"\n";
}
for(int x =1;x<=9;x++)
{
for(int z = 1;z<=x;z++)
{
cout<<" ";
}
for(int y=1;y<=b;y++)
{
cout<<" ";
cout<<"*";
}
cout<<"\n";
b--;
}
return 0;
}
Output:
.exe file |
There is many for loops out there....
ReplyDelete