Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void f(int n, int i = 1) {
- for (int j = 1; j <= i; ++j) {
- cout << i << " ";
- }
- cout << endl;
- if (i < n) {
- f(n, ++i);
- }
- }
- int main() {
- int n;
- cin >> n;
- f(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement