How to do this program?
Write a C++ program using two for loops to produce the following pattern of asterisks.
*
**
***
****
*****
******
*******
********
Rewrite the program using two while loops.
Homework huh?
-Have a for loop which a variable increases each time the loop runs
-Print '*' the number of times the variable is.
If you want me to give you code, convince me to do so by giving me code.
HTH,
Aceix.
For a better help, please post some code, then we pick it up from there.
Aceix.
Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
using namespace std;
int main()
{
int a;
for (a=0;a<8;a++)
{
cout<<"*";
for (int b = 0 ; a>b ; b++)
{
cout << "*";
}
cout << endl;
}
}
|
Last edited on