+ 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; } }}
2 Réponses
+ 3
m = count.nextInt();
+ 1
Add in
m=count.nextInt() ;