keepkoding
Question
ENTER THE NUMBER OF TERM : 10 FIBONACCI SERIES : 0 1 1 2 3 5 8 13 21 34
Code
import java.util.Scanner; public class fibonacciSeries { public static void main(String[] args) { int n=0,i=0,a=0,b=1,c=0; Scanner sc = new Scanner(System.in); System.out.println("Enter size of series"); n = sc.nextInt(); System.out.print(a+" "+b); for(i=2;i< n;i++) { c=a+b; System.out.print(" "+c); a=b; b=c; } } }
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Do you need help with your computer project or assignment?