- #1
jacy
- 76
- 0
Hello,
I am trying to print an equilateral triangle, made up of * (stars), of height 8. Can someone please give me some hint. I am not getting the desired output. Thank you. Here is my code.
I am trying to print an equilateral triangle, made up of * (stars), of height 8. Can someone please give me some hint. I am not getting the desired output. Thank you. Here is my code.
Code:
#include<iostream.h>
#include<iomanip.h>
void main()
{
int n=8;
for (int row=1; row<=8; row++)
{
for (int col=0; col<row; col++)
{
cout<<setw(n=n-1)<< '*';
}
cout << endl; // end the line.
}
}
Last edited: