60 627
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #4166 in Java | JSP | JSF for naveen

Question #4166
I want to output 0,1,1,2,3,5,8,13,21,34
Expert's answer
public class Fibonacci{ public static void main(String[] args){
int current = 1;
int previous = 0;
int temp =0;
while (current<50){
temp = current;
System.out.println(current);
current = previous + current;
previous = temp;
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions