C编程题改错。急!!!

来源:百度知道 编辑:UC知道 时间:2024/05/08 23:40:24
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
fun (int n)
{
int a=2,b=1,c,k;
double s=0.0;
for(k=1;k<=n;k++)
{
s=s+(Dobble)a/b;
c=a;a=a+b;b=c;
}
return(s);
}
void main()
{
int n=5;
system("CLS");
printf("\nThe value of funtion is:%1f\n",fun(n));
}
看看这个程序有什么错误,找出来,使其得出正确的结果。
希望有分析。。

fun()是没有返回值的。你改一下。然后看里面有没有书写错误。改正以后,应该就没有问题了。

fun (int n)没有返回值啦。

1. fun()没返回值;
2。s=s+(Dobble)a/b; 中double拼写有误吧?