Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Name: ________________________________ ID: ____________________

Write a ready-for-compilation C++ program to generate shape as shown in output window for
depth N (N is given by user). Notice that, two triangles are generated, with alternate rows
printing different symbols (one with *, $ and other with @, #). If executed, the output window of
your program may be as follows:

RUN-1:
==========

Enter the depth: 5

* @ @ @ @ @

$ $ # # # #

* * * @ @ @

$ $ $ $ # #

* * * * * @
Press any key to continue

RUN-2:
============

Enter the depth: 7
* @ @ @ @ @ @ @
$ $ # # # # # #
* * * @ @ @ @ @
$ $ $ $ # # # #
* * * * * @ @ @
$ $ $ $ $ $ # #
* * * * * * * @
Press any key to continue

You might also like