POJ1004

再次发现找不到原因的错误。。。。输入用double类型会WA,而用float则AC,求解

#include <cstdio>
using namespace std;

int main() {
	float n, sum = 0;
	for (int i = 0; i < 12; i++) {
		scanf("%f", &n);
		sum += n;
	}
	printf("$%.2f", sum/12);
	return 0;
}

 

posted @ 2018-10-12 17:25  JonnyOu1012  阅读(14)  评论(0)    收藏  举报