Advertisement
awsmpshk

Untitled

Mar 31st, 2020
118
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void print(int n, int i = 1) {
  6.     if (i <= n) {
  7.         for (int k = 1; k <= i; ++k) {
  8.             cout << i << " ";
  9.         }
  10.         cout << endl;
  11.         print(n, ++i);
  12.     }
  13. }
  14.  
  15. int main() {
  16.     int n;
  17.     cin >> n;
  18.     print(n);
  19.     return 0;
  20. }
Advertisement
RAW Paste Data Copied
Advertisement