Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cout << "Podaj wysokosc choinki: ";
- cin >> n;
- int k = 2 * n - 1;
- for(int i = 0; i < n; ++i) // zmienna i określa nr wiersza
- {
- for(int j = 0; j < k; ++j) // zmienna j określa nr kolumny
- {
- if(((i + j) < (k - 1)/2) || (j > (k - 1)/2 + i))
- cout << ' ';
- else
- cout << '*';
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment