Advertisement
JosepRivaille

P79860: Barres (2)

Apr 6th, 2015
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void pintar_linies(int n) {
  6.     if (n > 1) {
  7.         for (int i = 0; i < n; ++i) cout << '*';
  8.         cout << endl;
  9.         pintar_linies(n - 1);
  10.         pintar_linies(n - 1);
  11.     }
  12.     else {
  13.         cout << '*' << endl;
  14.     }
  15. }
  16.  
  17. int main() {
  18.     int n;
  19.     cin >> n;
  20.     pintar_linies(n);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement