Write a program that produces the following output using nested for loops.
****** ///////////// ******
***** ///////////\\ *****
**** /////////\\\\ ****
*** //////\\\\\\\ ***
** ////\\\\\\\\\ **
* //\\\\\\\\\\\ *
\\\\\\\\\\\\\
using namespace std;
int main() {
int c =2;
int g =7;
for(int i=6; i>=0; i--)
{
if(i == 0)
{
for(int d =0; d<13; d++)
{
cout<<"\\";
}
break;
}
for(int j=i; j>0; j--)
{
cout<<"*";
}
cout<<" ";
if(i>3)
{
for(int k = 2*i+1; k>0; k --)
{
cout<<"/";
}
}
else{
for(int n = 2*i; n>0; n--)
{
cout<<"/";
}
}
if(i<6 && i>=4)
{
for(int a=0; a<c; a++)
{
cout<<"\\";
}
c+=2;
}
else if(i<4){
for(int t = 0; t<g; t++)
{
cout<<"\\";
}
g+=2;
}
cout<<" ";
for(int m=i; m>0; m--)
{
cout<<"*";
}
cout<<endl;
}
}
Comments
Leave a comment