参考代码:
#include<iostream> #include<iomanip> using namespace std; int main(){ int count = 0; double arg = 0; int x[20]; for(int i=0; i<20; i++){ cin >> x[i]; if(x[i]<0) count++; if(x[i]>0) arg += x[i]; } arg = arg / (20-count); cout << count << endl; cout << setiosflags(ios::fixed) << setprecision(2) << arg; return 0; }
0.0分
5 人评分
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:687 |
字符串输入输出函数 (Java代码)浏览:1488 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:1240 |
1009题解浏览:798 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:532 |
简单的a+b (C语言代码)浏览:527 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:611 |
C二级辅导-计负均正 (C语言代码)浏览:520 |
交换Easy (C语言代码)浏览:805 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:530 |