Muscle Java
Thursday, October 17, 2019
Fibonacci Series
Program
package fibo;
public class Fibo
{
public static void main(String[] args)
{
int n = 10;
int f = 1,s = 1,t;
System.out.println(f);
System.out.println(s);
for(int i = 3; i<= n; i++)
{
t = f + s;
System.out.println(t);
f = s;
s = t;
}
}
}
Video explanation
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment