The question is here :
Problem III: Write a C++ program that outputs a series of stars of even
number using a for-loop statement. Your screen should appear as follows:
Enter the value of the number n: 17
**
****
******
********
**********
Here is what i come up with :
#include <iostream>
using namespace std;
void main()
{ int n, i;
cout<<"Enter The value of n";
cin >>n;
for ( i = 1; i <= n; i++ )
{
for ( int j = 1; j <= i; j++)
cout << "*";
cout << endl;
}
}
I even tried to replace j++ with j+=2 but it did not work
Thank you in advance.

New Topic/Question
Reply



MultiQuote



|