Skip to main content

Fibbonacci series

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,lim,a=0,b=1,c;
printf("Enter the limit:");
scanf("%d",&lim);
printf("%d,%d",a,b);
for(i=3;i<=lim;i++)
{
c = a+b;
a = b;
b = c;
printf(",%d",c);
}
getch();
}

Comments

Popular posts from this blog

Reversing digits of a number

#include<stdio.h> #include<conio.h> void main() { clrscr(); int ,num,rev=0,rem; printf("Enter the number:"); scanf("%d",&num); while(num!=0) { rem=num%10; rev=rev*10+rem; num=num/10; } printf("Reverse of given Number is:%d",rev); getch(); }