Bank of America Interview Question

Print out the first 5 fibonacci numbers

Interview Answer

Anonymous

Jul 26, 2017

for(int i=1; i<=5; i++){ if(i<=2) System.out.println(i); else{ System.out.println((i-1)+(i-2)); } }

Bank of America Interview Question: Print out the first 5 fibonacci numbers | Glassdoor