Respuesta :

Answer:

The code to this question can be defined as follows:

#include <iostream>//header file

using namespace std;//namespace

int main()//main method

{

int x,y;//defining variable

for(x = 1; x <= 7; x++)//defining outter for loop for print rows

{

for(y = 1; y <= 7; y++)//defining inner for loop for print column

{

if(y <= x)//defining if block to check y less then equal to x

cout << "*";//print asterisk value

else//defining else block

cout << " ";//use for spacing

}

for(y = 7; y >= 1; y--)//defining for loop for print right triangle

{

if(y <= x)//defining if block to check y less then equal to x

cout << "*";//print asterisk value

else//defining else block

cout << " ";//use for spacing  

}

cout << "\n";//use for line break

}

return 0;

}

Output:

please find the attachment.

Explanation:

In the above program code, two integer variable "x, y" is declared, which is used in the for a loop. In this, two for loop is used to print the left triangle, and the last loop is used to print the right triangle. In both, the loop uses if block to check y is less than equal to x and print the asterisk value with the spacing.

Ver imagen codiepienagoya