Computer Science, asked by ssanith, 9 months ago

Write a Java Program to display numbers from 0.0 to 0.9 using while loop it should be easy no scanner class, no string

Answers

Answered by dadapp67
0

Answer:public class JavaExample {

public static void main(String[] args) {

int count = 7, num1 = 0, num2 = 1;

System.out.print("Fibonacci Series of "+count+" numbers:");

for (int i = 1; i <= count; ++i)

{

System.out.print(num1+" ");

/* On each iteration, we are assigning second number

* to the first number and assigning the sum of last two

* numbers to the second number

*/

int sumOfPrevTwo = num1 + num2;

num1 = num2;

num2 = sumOfPrevTwo;

}

}

}

Hope it help you

Similar questions