#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int average(int x, int y)
{ int z = x + (y-x)/2; //求两数平均值的函数式
return z;
}
int main()
{ int b=0;
int a=0;
int c=0;
printf(“输入两个操作数:>”);
scanf("%d %d",&a,&b);
c = average(a, b); //求平均值函数的调用
printf(“sum=%d\n”, c);
system(“pause”);
return 0;
}
运用函数调用法求两数的平均(C语言)
最新推荐文章于 2024-05-14 23:58:04 发布