Contest entry-average

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;
}

Guess you like

Origin blog.csdn.net/mjh1667002013/article/details/113285440