Answer:
b. 0 1 1 2 3 5 8 13 21 34
Step-by-step explanation:
- int f1 = 0; creates an integer variable named f1 and sets its value as 0
- int f2 = 1; creates an integer variable named f2 and sets its value as 1
- fRes; creates an integer variable with no value
- System.out.print(f1 + " "); prints the value of f1 (0)
- System.out.print(f2 + " "); prints the value of f2 (1)
- The for loop runs 9 times and sets the value of fRes to the sum of f1 and f2, prints fRes, changes the value of f1 to f2, and changes the value of f2 to the current value of fRes
- System.out.printIn() prints a new line
The result of the loop block will be
- (0 + 1) = 1
- 1 + 1 = 2
- 1 + 2 = 3
- 2 + 3 = 5
- 3 + 5 = 8
- 5 + 8 = 13
- 8 + 13 = 21
- 13 + 21 = 34
- 21 + 34 = 55
So, it first prints "0 1" (the value of the first 2 variables), then the result of the the loop block
That would be 0 1 1 2 3 5 8 13 21 34 55