#include<iostream>
using namespace std;
int main() {
int height, star{ 0 };
cout << "Enter height of triangle";
cin >> height;
for(int i=1; i<=height; i++)
{
if(star<i)
{
cout << "*";
++star;
continue;
}
cout << endl;
star = 0;
}
}
This is printing stars in a line I want to print one star in 1st line then 2 in second line and so forth.
Example:
*
**
***
****
Image:
