Java

Fibonacci Serious Program using Java

Fibonacci Serious Program using Java
import java.io.*; 

class fib 
{ 
public static void main(String arg[]) throws IOException 
{ 
int f1=-1,f2=1,f3,i,n; 

String s = new String(); 

DataInputStream dr = new DataInputStream(System.in); 

System.out.println("emter the number : "); 

s = dr.readLine(); 

n=Integer.parseInt(s); 

for(i=0;i<n;i++) 
{ 
f3 = f1+f2; 
System.out.println(f3); 
f1=f2; 
f2=f3; 
} 
} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.