1public class Fibonacci {
2
3 public static void main(String[] args) {
4
5 int i = 1, n = 10, t1 = 0, t2 = 1;
6 System.out.print("First " + n + " terms: ");
7
8 while (i <= n)
9 {
10 System.out.print(t1 + " + ");
11
12 int sum = t1 + t2;
13 t1 = t2;
14 t2 = sum;
15
16 i++;
17 }
18 }
19}