Write a program using two for loops to produce the following pattern of asterisks
*
**
***
****
*****
******
*******
********
#include <iostream>
using namespace std;
int main() {
const int n = 8;
for (int i=0; i<n; i++) {
for (int j=0; j<=i; j++) {
cout << '*';
}
cout << endl;
}
return 0;
}
Comments
Leave a comment