Can somebody explain why this code results in 1 for input: exam(5)?
exam<-function(x){
y<-1
if(x==1){
return(1)
}
else{
return(y*exam(x-1))
y<-y+1
}
}
Can somebody explain why this code results in 1 for input: exam(5)?
exam<-function(x){
y<-1
if(x==1){
return(1)
}
else{
return(y*exam(x-1))
y<-y+1
}
}