Domanda di colloquio di Innodata

Q:Print fibonacci series using do while loop?

Risposta di colloquio

Anonimo

13 gen 2017

I solved this question in this way:- int firstVal= 0; int secondVal = 1; int currVal; System.out.println(prevPrevVal); System.out.println(prevVal); do { currVal = firstVal + secondVal; System.out.println(currVal); firstVal = secondVal; secondVal = currVal; } while (secondVal <= 100); And they replied good.