Print the following pattern of star, taking numbers of rows as an input. Following is an example of input-5 * ** *** **** ***** Test Case 1 Input (stdin) 5 Expected Output * ** *** **** ***** Test Case 2 Input (stdin) 7 Expected Output * ** *** **** ***** ****** *******
#include <iostream>
using namespace std;
int main()
{
int n,i,j;
cin>>n;
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
cout<<"*";
cout<<"\n";
}
return 0;
}