Help me pls. Taking 13 characters in array and the number of rows; i have to print a proper pyramid using (for-do while-while)
https://www.sololearn.com/compiler-playground/cAbgIj1boAFt #include <iostream> using namespace std; int main() { int space, rows; char arr[13]; cout<<"Enter 13 characters : "<<endl; for(int x=0;x<13;x++){ cin>>arr[x]; } cout <<"Enter number of rows: "; cin >> rows; for(int i = 1, k = 0; i <= rows; i++, k = 0) { // for(space = 1; space <= rows-i; space++) // { // cout <<" "; // } space=1; do{ cout<<" "; space++; }while(space<=rows-i); while(k != 2*i-1) { cout <<arr[k]<<" "; k++; } cout << endl; } return 0; } input:1234567891234 input:7 output: 1 1 2 3 1 2 3 4 5 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 1 2 3 4 5 6 7 8 9 1 2 3 4 //as you can see the last line has a space that ruins the pyramid. kindly help me with this. the submission date is near.