Link to home
Start Free TrialLog in
Avatar of mustish1
mustish1

asked on

Needs help in logic

Hi guys: Can any one please help me how to i print the * in that order that first it print one then two and then three. I try it first but made mistakes as its printing three in each row

Output required
*
**
***

#include <iostream>
using namespace std;

int main()
{
      for (int row = 1; row < 4; row +=1)
      {
            for(int asterisks = 1; asterisks <= 3; asterisks +=1)
                  cout << '*';
      cout << endl;
      }
      system("pause");
      return 0;
}
Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

change asterisks <= 3 to asterisks <= row
Avatar of mustish1
mustish1

ASKER

Thanks. just last thing how to i reverse it means
***
**
*
replace asterisks <= row with asterisks <= (4-row)
ASKER CERTIFIED SOLUTION
Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.