Advertisement
awsmpshk

Untitled

Feb 25th, 2020
144
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 f(int n, int i = 1) {
  6. for (int j = 1; j <= i; ++j) {
  7. cout << i << " ";
  8. }
  9. cout << endl;
  10. if (i < n) {
  11. f(n, ++i);
  12. }
  13. }
  14.  
  15. int main() {
  16. int n;
  17. cin >> n;
  18. f(n);
  19. return 0;
  20. }
Advertisement
RAW Paste Data Copied
Advertisement