Lower right trianlge
drawLowerRightTriangle() draws a lower right trianlge and it takes 2 parameters:
noOfLines takes the number of lines.
ch takes the character to be displayed in the lower right trianlge.
Code
#include "stdafx.h"
#include "iostream"
#include "conio.h"
#include "iomanip"
using namespace std;
void drawLowerRightTriangle(int noOfLines,char ch)
{
for (int k = 0; k < noOfLines; k++)
{
for (int l = noOfLines; l > k; l--)
cout<<ch;
cout<<endl;
}
}
int main()
{
drawLowerRightTriangle(15,'*');cout<<endl;
_getche();
return 0;
}
Output
***************
**************
*************
************
***********
**********
*********
********
*******
******
*****
****
***
**
*
0 comments:
Post a Comment