Fibonacci number print using recrusion
<script>
function fnnumber(n){
if(n<2){
return n;
}else{
return fnnumber(n-1)+ fnnumber(n-2);
}
}
var number = prompt("Enter the Number to the show fibnocci number");
if(number <= 0){
var number = prompt("Enter positive number");
}else{
for(var i=0;i<number;i++){
console.log(fnnumber(i));
}
}
</script>
Thanks you for commenting your questions. I will see question and respond you.