-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFIBO.C
37 lines (34 loc) · 855 Bytes
/
FIBO.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<conio.h>
#include<stdio.h>
void fibo2(firstnum,secondnum,limit){
int addition;
printf("%d,%d", firstnum,secondnum);
for (addition = firstnum + secondnum;addition < limit;firstnum = secondnum, secondnum = addition, addition=firstnum+secondnum){
printf(",%d", addition);
}
getch();
}
void fibo(firstnum,secondnum,limit){
int addition;
addition = firstnum + secondnum;
printf("fibonanci : ");
printf("%d,%d", firstnum,secondnum);
while(addition <= limit){
printf(",%d",addition);
firstnum = secondnum;
secondnum = addition;
addition = firstnum + secondnum;
}
getch();
}
void main(){
int firstnum,secondnum,limit;
clrscr();
printf("Enter First number:");
scanf("%d", &firstnum);
printf("Enter Second number:");
scanf("%d", &secondnum);
printf("Enter Limit:");
scanf("%d", &limit);
fibo2(firstnum,secondnum,limit);
}