Andrew L. answered 05/25/20
practice makes perfect
#include <stdio.h>
#include <iostream>
using namespace std;
//n as the input of the function
int main()
{
int n = 4;
for (int i=1; i < n; i++) {
int k = i * i;
for (int j=0; j < k; j++) {
cout << "*";
}
cout << "\n";
}
for (int i=n; i > 0; i--) {
int k = i * i;
for (int j=0; j < k; j++) {
cout << "*";
}
cout << "\n";
}
return 0;
}