Write a program that produces the following output using nested for loops.
****** ///////////// ******
***** ///////////\\ *****
**** /////////\\\\ ****
*** //////\\\\\\\ ***
** ////\\\\\\\\\ **
* //\\\\\\\\\\\ *
\\\\\\\\\\\\\
#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;
}
Comments
Leave a comment