Hey guys How to write a Code for Getting output to this pattern.
Getting Stars with this Pattern
How to write it using For loop or nested loop?
Without if else statement.
*****
-****
--***
---**
----*
I have coded this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
using namespace std;
int main()
{
int max_row = 5;
for (int i = 0; i < max_row; i++);
{
for (int j = 0; j < max_row; j++);
{
if (j >= i)
{ cout << "*"; }
else{ cout << " "; }
}
cout << endl;
}
return 0;
}
|
Last edited on