-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCounterFibo.c
More file actions
37 lines (32 loc) · 738 Bytes
/
CounterFibo.c
File metadata and controls
37 lines (32 loc) · 738 Bytes
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 <stdio.h>
#include <stdlib.h>
int count = 1;
int Fibo(int n, int a, int b)
{
if(n == 0){
count += 2;
return a;
}
else if(n == 1){
count +=2;
return b;
}
else{
count++;
return Fibo(n-1, b, a+b);
}
}
int main()
{
int n, a = 0, b = 1; count++;
printf("Enter Value of n : "); count++;
scanf("%d", &n); count++;
//printf("%d %d ", a, b); count++;
count++; // FOR INITIALISATION OF FOR LOOP
for(int i=0; i<n; i++, count++)
{
count++; // FOR LOOP CONDITION CHECK COUNT++
printf("%d\t", Fibo(i, a, b)); count++;
}
printf("\n Counter : %d\n", count);
}