Computer Science, asked by kajal787chakraborty2, 11 months ago

java program sum of fibonicci series​

Answers

Answered by Anonymous
22

Answer:

public class Fibonacci

{

public static void main(String args [])

{

int num1 = 0, num2 = 1;

int sum = 0;

System.our.println("Fibonacci series is: ");

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

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

sum = num1 + num2;

while (sum <= 100)

{

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

num1 = num2;

num2 = sum;

sum = num1 + num2;

}

}

}

Answered by Shakshi1819
1

public class Fibonacci

{

public static void main(String args [])

{

int num1 = 0, num2 = 1;

int sum = 0;

System.our.println("Fibonacci series is: ");

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

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

sum = num1 + num2;

while (sum <= 100)

{

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

num1 = num2;

num2 = sum;

sum = num1 + num2;

}

}

}

Similar questions