top of page

FIBONACCI SERIES

Writer's picture: Code CrazeCode Craze


#include <stdio.h>


int main() {

int n1=0,n2=1,temp;

int n,i;

printf("\nEnter the range : ");

scanf("%d",&n);

printf("\n%ld %ld ",n1,n2);

for(i=2;i<n;i++)

{

temp=n1+n2;

n1=n2;

n2=temp;

printf(" %ld",temp);

}

}

0 views0 comments

Recent Posts

See All

Stack Using Queue

A stack can be implemented using two queues in C. The basic idea is to use one queue for enqueue operations and another for dequeue...

Queue Using Stack

A queue can be implemented using two stacks in C. The basic idea is to use one stack for enqueue operations and another for dequeue...

Queue Using Array

#include <stdio.h> #include<stdlib.h> #include<math.h> #define size 5 int queue[size]; int front = -1; int rear = -1; void enque(void);...

Comments


bottom of page