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;
}
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;
}
change asterisks <= 3 to asterisks <= row
ASKER
Thanks. just last thing how to i reverse it means
***
**
*
***
**
*
replace asterisks <= row with asterisks <= (4-row)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.