importjava.util.Scanner;classFibonacci{publicstaticvoidmain(String[]args){Scannerscanner=newScanner(System.in);System.out.println("How many Fibonacci numbers do you want to print?");intn=scanner.nextInt();intprevF=1;intprevPrevF=1;for(inti=1;i<=n;i++){if(i==1){System.out.println("Fibonacci number 1 is: 1");}elseif(i==2){System.out.println("Fibonacci number 2 is: 1");}else{intf=prevF+prevPrevF;System.out.println("Fibonacci number "+i+" is: "+f);// Update for the next cycleprevPrevF=prevF;prevF=f;}}}}