Topic:
Enter 3 integers, output their average, and keep 3 decimal places.
#include<stdio.h>
#include<math.h>
int main() {
int a,b,c;
double d;
scanf("%d%d%d",&a,&b,&c);
d = (double)(a+b+c)/3; //强制转换
printf("%.3lf",d);
return 0;
}
Topic:
Enter 3 integers, output their average, and keep 3 decimal places.
#include<stdio.h>
#include<math.h>
int main() {
int a,b,c;
double d;
scanf("%d%d%d",&a,&b,&c);
d = (double)(a+b+c)/3; //强制转换
printf("%.3lf",d);
return 0;
}