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