java program sum of fibonicci series
Answers
Answered by
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
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
Math,
6 months ago
English,
6 months ago
English,
11 months ago
Math,
11 months ago
Social Sciences,
1 year ago