9 (Display pyramid) Write a program that prompts the user to enter an integer from 1 to 15 and displays a pyramid, as shown in the following sample run

PHOTO EMBED

Sat Oct 24 2020 03:24:57 GMT+0000 (Coordinated Universal Time)

Saved by @mahmoud hussein #c++

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{



    int rows;
    cin >> rows;

    for (int i = 1; i <= rows; i++)
    {
        for (int k = 1; k <= (rows -i); k++)
        {
            cout << "   ";
           
        }
        for (int d = i; d > 1; d--)
            {
            cout << d << "  ";
                
            }
        for (int  v = 1; v <= i; v++)
        {
            cout << v<<"  ";
        }
        cout << endl;

        
    }


}
content_copyCOPY

http://cpp.sh/