fibbonacci
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811,
fibbonacci
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811,
Fibonacci
import java.util.Scanner;
public class Fibonacci
{
public static void main(String[] args)
{
int n, a = 0, b = 0, c = 1;
Scanner s = new Scanner(System.in);
System.out.print("Enter value of n:");
n = s.nextInt();
System.out.print("Fibonacci Series:");
for(int i = 1; i <= n; i++)
{
a = b;
b = c;
c = a + b;
System.out.print(a+" ");
}
}
}
fibonacii
#include<stdio.h>
#include<conio.h>
void fibonacci(int num);
void main()
{
int num = 0;
clrscr();
printf("Enter number of terms\t");
scanf("%d", &num);
fibonacci(num);
getch();
}
void fibonacci(int num)
{
int a, b, c, i = 3;
a = 0;
b = 1;
if(num == 1)
printf("%d",a);
if(num >= 2)
printf("%d\t%d",a,b);
while(i <= num)
{
c = a+b;
printf("\t%d", c);
a = b;
b = c;
i++;
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us