0
How can I do this code ?
Using recursion function prints the factorial of numbers between 1-100
6 Answers
+ 2
What you mean by who can do this ? We don't code for you if that's what you are asking for ,a little better question would be "how can I solve it ,I have been trying for so and so hours ,searching everywhere but can't seem to understand how recursion works "
Also link the code you have tried so far so people can assist you further
+ 1
#include <iostream.h>
long long f(long long x){
if(x==1||x==0)
return 1;
else
return x*f(x-1);}
int main(){
for(long long i=2;i<22;i++)
{
cout<<f(i)<<endl;}
}
+ 1
This is my code
But the teacher said he wants the code without using loop
0
This is for one number
I want for numbers 1 to 100