C++程序,从键盘输入3个整数,打印和,及平均值?

我请问下,C++程序,从键盘输入3个整数,打印和,及平均值?
最新回答
安非他命

2024-09-14 06:53:06

#include<stdio.h>
void main()
{ int a,b,c;
scanf("%d,%d,%d",&a,&b,&c);
printf("input three different integer;%d,%d,%d",a,b,c);
printf("sum is %d\n",a+b+c);
printf("average is %f\n",(float)(a+b+c)/3);
}
Mentos曼妥思

2024-09-14 13:56:23

main()
{ int a,b,c;
scanf("%d,%d,%d",&a,&b,&c);
printf("input three different integer;%d,%d,%d",a,b,c);
printf("sum is %d",a+b+c);
printf("average is %d",(a+b+c)/3);
}