Skip to content

Commit 8ef5f8b

Browse files
authored
Fibonacci Search (Algorithm) added
1 parent 4d4ce48 commit 8ef5f8b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Fibonacci Search

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <stdio.h>
2+
int main()
3+
{
4+
int i, n, t1 = 0, t2 = 1, nextTerm;
5+
6+
printf("Enter the number of terms: ");
7+
scanf("%d", &n);
8+
9+
printf("Fibonacci Series: ");
10+
11+
for (i = 1; i <= n; ++i)
12+
{
13+
printf("%d, ", t1);
14+
nextTerm = t1 + t2;
15+
t1 = t2;
16+
t2 = nextTerm;
17+
}
18+
return 0;
19+
}

0 commit comments

Comments
 (0)