Print Numbers
Send Feedback
Integer n
Numbers from 1 to n (separated by space)
1 <= n <= 10000
6
1 2 3 4 5 6
4
1 2 3 4
SOLUTION:-
#include<iostream>
using namespace std;
void print(int n){
//if(n>=1&&n<=10000)
//{
static int i=1;
if(n == 1){
cout << i << " ";
return;
}
cout << i << " ";
i++;
print(n - 1);
//}
}
int main(){
int n;
cin >> n;
print(n);
}
This is dummy text. It is not meant to be read. Accordingly, it is difficult to figure out when to end it. But then, this is dummy text. It is not meant to be read. Period.
If you have any doubts then please let me know... ConversionConversion EmoticonEmoticon