#include <stdio.h>
int foo(int num){
int sum;
if (num == 0){
return sum = 3;
} else if(num == 1){
return sum = 6;
} else if (num == 2){
return sum = 2;
} else if (num == 3){
return sum = 7;
} else{
return foo(num - 1) + foo(num - 2) + foo(num - 3) - foo(num - 4) + 1;
}
}
int main() {
int sum;
int num;
printf("Enter a value for n: ");
scanf("%d", &num);
sum = foo(num);
printf("Foo(%d) = %d\n", num, sum);
return 0;
}
int foo(int num){
int sum;
if (num == 0){
return sum = 3;
} else if(num == 1){
return sum = 6;
} else if (num == 2){
return sum = 2;
} else if (num == 3){
return sum = 7;
} else{
return foo(num - 1) + foo(num - 2) + foo(num - 3) - foo(num - 4) + 1;
}
}
int main() {
int sum;
int num;
printf("Enter a value for n: ");
scanf("%d", &num);
sum = foo(num);
printf("Foo(%d) = %d\n", num, sum);
return 0;
}