Skip to content

Commit 6c179aa

Browse files
authored
Merge pull request #4 from roysuraj/patch-1
Create fibonacci
2 parents e95a12b + 21280cd commit 6c179aa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

fibonacci

Lines changed: 19 additions & 0 deletions
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)