#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
for (int j = 0; j <= i; j++)
{
cout << "*";
}
cout << "
";
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int size = 5;
for (int i = 0; i < size; i++) {
// print spaces
for (int j = 0; j < size - i - 1; j++) {
cout << " ";
}
// print stars
for (int k = 0; k < 2 * i + 1; k++) {
cout << "*";
}
cout << "
";
}
return 0;
}
/* Output
*
***
*****
*******
*********
*/
#include <iostream>
using namespace std;
int main()
{
int rows;
cout << "Enter number of rows: ";
cin >> rows;
int i = 1;
while(i <= rows)
{
int j = 1
while(j <= i)
{
cout << "* ";
j++
}
cout << "
";
i++;
}
return 0;
}