Advertisement
Spocoman

07. Christmas Tree

Sep 13th, 2023
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.  
  9.     for (int i = 0; i <= n; i++) {
  10.         for (int j = 0; j < n - i; j++) {
  11.             cout << " ";
  12.         }
  13.  
  14.         for (int k = 0; k < i; k++) {
  15.             cout << "*";
  16.         }
  17.         cout << " | ";
  18.  
  19.         for (int k = 0; k < i; k++) {
  20.             cout << "*";
  21.         }
  22.         cout << endl;
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement