C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Fibonacci Series Using Java With I/O Stream
WhatsApp
Senthilvelan Sambamoorthy
6y
18.4
k
0
0
25
Blog
fib.rar
Introduction
In this blog, I will explain about a Fibonacci series program, using Java I/O stream. It is very simple in Java programming. The output will be displayed in the Run module.
Software Requirement
JDK1.3.
Simple program
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;
}
}
}
Explanation
In this blog, I explained about a Fibonacci series program, using Java I/O Stream. The output will be displayed in the Run module.
Output
People also reading
Membership not found