#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<string> using namespace std; int main() { double sum = 0; for (int i = 0; i < 12; i++) { double temp; cin >> temp; sum += temp; } double res = sum / (double)12; printf("$%.2lf\n", res);//printf函数有自动四舍五入的功能 return 0; } |
Double click to view unformatted code.