Monday, January 24, 2022

fibonacci series of first 10 element

                 int f1 = 0, f2 = 1;

int f3 = 0;

System.out.print(f1+" ");

System.out.print(f2+" ");

for (int i = 1; i <=8; i++) {

f3 = f1 + f2;

System.out.print(f3+" ");

f1 = f2;

f2 = f3;

}

No comments:

Post a Comment

Clean code chapter 3(Robert C.martin)

  Summary: --------  1. Functions should hardly ever be 20 lines long.  2.Keep blocks (inside if, else, while, for, etc.) short.  Ideally, j...