Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Day1Java {
- int fibb(int a,int b) {
- for(int i=0;i<no;i++){
- int c=a+b;
- a=b;
- b=c;
- return(c);
- }
- }
- public static void main(String[] args) {
- Scanner sc=new Scanner(System.in);
- System.out.println("enter number of terms: ");
- int no=sc.nextInt();
- int a=0,b=1,c;
- Day1Java day1Java=new Day1Java();
- day1Java.fibb(a,b);
- sc.close();
- }
- }
Add Comment
Please, Sign In to add comment