I'm using while loop inside for loop to repeat for loop, but it only execute one time.
I did this code:
#include<iostream>
using namespace std;
int h, rep = 0;
int main() {
cout << "Please enter pyramid's height: ";
cin >> h;
cout << "Please enter Repetition Number: ";
cin >> rep;
for(int i = 0; i <= h; i++) {
while(0 < rep) {
for(int j = 0; j <= h; j++) {
if(i >= j)
cout << "x ";
else
cout << " ";
}
rep--;
}
cout << endl;
}
}