#include #include using namespace std; void piramida (int); void main () { int n; cout << "Introduceti inaltimea: "; cin >> n; piramida (n); getchar (); getchar (); } void piramida (int n) { if (n %2 == 0) { for (int i=1; i<=n; i++) { cout << setw (n-i+2); for (int k=1; k<=i*2; k++) { cout << "x"; } cout << endl; } } else { for (int i=1; i<=n; i++) { cout << setw (n-i+2); for (int k=2; k<=i*2; k++) { cout << "x"; } cout << endl; } } }