Answer to Question #184738 in C++ for Mridul

Question #184738

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



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

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

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

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

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

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

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


1
Expert's answer
2021-04-26T05:40:58-0400
#include <iostream>

int main()
{
    for (int i = 7; i >0; i--) 
    {
        for (int j = i - 1; j > 0; j--) 
        {
        std::cout <<"*";
        }
        for (int j = i - 1; j > 0; j-=7) 
        {
            std::cout << " ";
        }
        for (int j = 2*i - 1; j > 1; j --) 
        {
            std::cout << "/";
        }
        for (int j = 2 * i - 1; j < 13; j++) 
        {
            std::cout << "\\";
        }
        for (int j = i - 1; j > 0; j -= 7)
        {
            std::cout << " ";
        }
        for (int j = i - 1; j > 0; j--)
        {
            std::cout << "*";
        }
     std::cout<<std::endl;
    }
    return 0;
}

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