1.
int average(int a,int b)
{
return a + (b - a) / 2;
}
int main()
{
int a = 0;
int b = 0;
printf("输入两个数\n");
scanf("%d%d", &a, &b);
printf("%d", average(a,b));
system("pause");
return 0;
}
2.
#include<stdio.h>
int main()
{
int a, b, c;
scanf("%d%d", &a, &b);
c = a + b;
c = c >> 1;
printf("%d\n", c);
system("pause");
return 0;
}