参考代码:
#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二级辅导-公约公倍 (C语言代码)浏览:1534 |
不会做的浏览:933 |
WU-链表数据求和操作 (C++代码)浏览:1352 |
三角形 (C++代码)递推浏览:791 |
哥德巴赫曾猜测 (C语言代码)浏览:2391 |
a+b浏览:441 |
文科生的悲哀 (C语言代码)浏览:1432 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:636 |
星期判断机 (C语言代码)浏览:875 |
图形输出 (C语言代码)浏览:1404 |