Skip to content

Commit fd96b60

Browse files
Create Fiabonacci Series.c
1 parent 0f9d230 commit fd96b60

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Fiabonacci Series.c

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include<stdio.h>
2+
3+
#include<stdlib.h>
4+
5+
6+
int main()
7+
8+
{
9+
10+
system("clear");
11+
12+
int n, i;
13+
14+
printf("Enter how many digits you want to print :");
15+
16+
scanf("%d", & n);
17+
18+
int array[100];
19+
20+
array[0] = 0, array[1] = 1;
21+
22+
for (i = 0; i <= n - 2; i++) {
23+
24+
array[i + 2] = array[i] + array[i + 1];
25+
26+
}
27+
28+
printf("{ ");
29+
30+
for (i = 0; i < n; i++) {
31+
32+
printf("%d\t", array[i]);
33+
34+
}
35+
36+
printf(" } \n");
37+
38+
}

0 commit comments

Comments
 (0)