import java.util.Scanner;
public class Question5 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the number of Fibonacci terms to generate: ");
int n = scanner.nextInt();
int first = 0, second = 1;
System.out.println("Fibonacci Sequence:");
for (int i = 1; i <= n; i++) {
System.out.print(first + " ");
int next = first + second;
first = second;
second = next;
}
}
}
/* Sample Output
Enter the number of Fibonacci terms to generate: 6
Fibonacci Sequence:
0 1 1 2 3 5
*/