问答题

给定程序MODI1.C中函数fun()的功能是按以下递归公式求函数值。



例如,当给n输入5时,函数值为18;当给n输入3时,函数值为14。
请改正程序中的错误,使它能得出正确结果。
#include<stdio.h>
/**********found**********/
int fun(n)
int c;
/**********found**********/
if(n=1)
c=10;
else
c=fun(n-1)+2;
return(c);

main()
int n;
printf("Enter n:");scanf("%d",&n);
printf("The result:%d\n\n",fun(n));

【参考答案】

(1)int fun(int n) (2)if(n==1)