JAVA Program to print first 10 numbers in Fibonacci series.
PROGRAM :
package com.company;
public class Fibo
{
public static void
main(String[] args)
{
int a,b,temp,n;
a=0;
b=1;
for(n=1;n<=10;n++)
{
System.out.println(a);
temp=a+b;
a=b;
b=temp;
}
}
}
OUTPUT :
Labels: JAVA Program to print first 10 numbers in Fibonacci series.


0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home