+ 3

could you find the error ??& corect it???

import java.util.Scanner; class FibonacciExample1{ public static void main(String args[]) { int n1=0,n2=1,n3,i,m; System.out.print(n1+" "+n2);//printing 0 and 1 Scanner count=new Scanner(System.in); m=count; for(i=2;i<m;++i)//loop starts from 2 because 0 and 1 are already printed { n3=n1+n2; System.out.print( " "+n3); n1=n2; n2=n3; } }}

18th Jul 2017, 5:28 AM
Abinandh S
Abinandh S - avatar
2 Antworten
+ 3
m = count.nextInt();
18th Jul 2017, 5:35 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Add in m=count.nextInt() ;
18th Jul 2017, 6:16 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar