Answer to Question #183620 in C++ for shuvo

Question #183620

Write a program that produces the following output using nested for loops.

****** ///////////// ******

***** ///////////\\ *****

**** /////////\\\\ ****

*** //////\\\\\\\ ***

** ////\\\\\\\\\ **

* //\\\\\\\\\\\ *

\\\\\\\\\\\\\ 


1
Expert's answer
2021-04-23T04:08:24-0400


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;
	}
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS