[主观题]

下列给定程序中,函数fun的功能是按以下递归公式求函数值。

例如:当给n输入5时,函数值为240;当给n输入3时,函数值为60。

请改正程序中的错误,使它能得到正确结果。

注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。

试题程序:

include <stdio.h>

/*************found****+*******/

fun(int n);

{

int c;

/*************found********+*****/

if(n=1)

c=15;

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));

}

参考答案与解析:

相关试题

下列给定程序中,函数fun的功能是按以下递归公式求函数值。 例如:当给n输入5时