import java.util.*; public class Fseries { int fiboseries(int num) { if(num==1) return(0); else if(num==2) return(1); else if(num>2) return(fiboseries(num-1)+fiboseries(num-2)); else return(-1); } public static void main() { Scanner in=new Scanner(System.in); System.out.println("Enter number of terms to display"); int n,p=0; n=in.nextInt(); Fseries ob=new Fseries(); System.out.println("The Fibo Series is :"); for(int i=1;i<=n;i++) { p=ob.fiboseries(i); System.out.println(p); } } }
Answers
Answered by
1
Answer:
dear I am unable to understand your question
sorry
Similar questions