#include <iostream>
using namespace std;

int main() {
    int altura;
    cout << "Altura: "; cin >> altura;
    
    for(int i = 1; i <= altura; i++) {
        // Imprimir espacios
        for(int j = 0; j < altura - i; j++) {
            cout << " ";
        }
        // Imprimir asteriscos
        for(int j = 0; j < (2 * i - 1); j++) {
            cout << "*";
        }
        cout << "\n";
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: