Skip to content

Commit b4a150e

Browse files
fibonacci series
to find fibonacci series
1 parent c5c05c2 commit b4a150e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

fibonacci series

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

0 commit comments

Comments
 (0)