Q10896/Fibonacciseries - Java: S.No: 2 Date: 2022-04-12
Q10896/Fibonacciseries - Java: S.No: 2 Date: 2022-04-12
ID: 20095A0363
Page No:
Aim:
Write a class FibonacciSeries with a main method. The method receives one command line argument.
Write a program to display fibonacci series i.e. 0 1 1 2 3 5 8 13 21.....
For example:
Cmd Args : 80
0 1 1 2 3 5 8 13 21 34 55
q10896/FibonacciSeries.java
package q10896;
class FibonacciSeries
int n=Integer.parseInt(args[0]);
int c=a+b;
while(c<=n)
System.out.print(" "+c);
a=b;
b=c;
c=a+b;
Test Case - 1
User Output
0 1 1 2 3 5
Test Case - 2
User Output
0 1 1 2 3 5 8 13 21 34 55
Test Case - 3
User Output
User Output
User Output
0 1 1 2 3 5 8
Test Case - 4
Test Case - 5
Test Case - 3
0 1 1 2 3 5 8 13 21 34 55
0 1 1 2 3 5 8 13 21 34 55
ID: 20095A0363
Page No:
Rajeev Gandhi Memorial College of Engineering and Technology (Autonomous) 2019-2023-MECH-FDH