From 22c610f05537d0145bbfb720479ecbaddf69d10e Mon Sep 17 00:00:00 2001 From: kushal sharma <43320217+kushal0074@users.noreply.github.com> Date: Tue, 25 Dec 2018 01:51:19 +0530 Subject: [PATCH] Fibonacci Series in Java A simple of printing Fibonacci series in Java using for loop and three variables this file consists a java program which on excecuting will show a Fibonacci series (0 1 1 2 3 5 8.......) --- Fib.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Fib.java diff --git a/Fib.java b/Fib.java new file mode 100644 index 0000000..44a57b2 --- /dev/null +++ b/Fib.java @@ -0,0 +1,15 @@ +class Fib{ + public static void main(String [] args){ + + int a=0,b=1,i; + System.out.println(a); + System.out.println(b); + for(i=2;i<10;i++){ + + int c=a+b; + a=b ; + b=c; + System.out.println(c); + } +} +} \ No newline at end of file