Solved

What Is the Output of the Following Code Snippet

Question 66

Multiple Choice

What is the output of the following code snippet?
Int f1 = 0;
Int f2 = 1;
Int fRes;
System.out.print(f1 + " ") ;
System.out.print(f2 + " ") ;
For (int i = 1; i < 10; i++)
{
FRes = f1 + f2;
System.out.print(fRes + " ") ;
F1 = f2;
F2 = fRes;
}
System.out.println() ;


A) 0 1 5 7 9 11 13 15 17 19
B) 0 1 1 2 3 5 8 13 21 34 55
C) 0 1 4 6 8 10 12 14 16 18
D) 0 1 6 7 9 12 14 17 19 21

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions