c语言怎么用一个主函数把下列两个函数调用出来

c语言怎么用一个主函数把下列两个函数调用出来#include <stdio.h>
#include <math.h>
int main()
{
double r=0,t=0;
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
t+=sqrt(i);
r+=t;
}
printf("%lf\n",r);
return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int a,b;
int r;
int i, s=0;
srand(time(NULL));
for(i = 0; i < 10; i ++)
{
a=rand()%90+10;
b=rand()%9+1;
if(a*b>=100)
{
i--;
continue;
}
printf("%d * %d = ", a,b);
scanf("%d",&r);
if(r==a*b)
{
printf("right\n");
s+=10;
}
else printf("wrong\n");
}
printf("total score:%d\n", s);
return 0;
}

把你上面拍入的内容, 略加修改 就可以了。
(1)把 第一个 int main() 改成 int fun1()
(2)把 第二个 int main() 改成 int fun2()
(3)在 上面拍入的内容 尾部 加入:
int main(){
fun1();
fun2();
return 0;
}
(4)存放起来,编译,运行 即可。fun1(); 调用你第一个程序,fun2(); 调用你第二个程序
温馨提示:答案为网友推荐,仅供参考
相似回答