CODE : a) WHILE LOOP public class P_04_fibb_while_loop { public static void main(String[] args) { int a=1,temp=0,b=0; System.out.println(a); while (a<10) { temp=a+b; b=a; a=temp; System.out.println(temp); temp++; } } } b) DO WHILE LOOP public class P_04_do_fibb_while_loop { public static void main(String[] args) { int a=1,temp=0,b=0; System.out.println(a); do{ temp=a+b; b=a; a=temp; System.out.println(temp); temp++; }while (a<10); } } c) FOR LOOP public class P_04_fibb_for_loop { public static void main(String[] args) { int a=1,temp=0,b=0; System.out.println(a); for(;a<10;temp++) { temp=a+b; b=a; a=temp; System.out.println(temp); } } } Output :