Advertisement
JosepRivaille

P62467: Barres (1)

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