Generate Fibonacci Series within a interval

Description:

Write a java program to Generate Fibonacci Series within a interval Test Case 1 Input (stdin) 11 100 Expected Output 11 12 23 35 58 93 Test Case 2 Input (stdin) 0 Expected Output 0

Program :


import java.util.Scanner;

 

public class TestClass {

public static void main(String args[]) {

Scanner scan = new Scanner(System.in);

int start = Integer.parseInt(scan.nextLine());

int end = Integer.parseInt(scan.nextLine());

int a = start;

int b = 1;

int c = 0;

c = start;

while(c <= end) {

int temp = a;

a = b;

b = c;

System.out.println(c);

c = a + b;

}

}

}