参考代码:
#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分
4 人评分
【C语言训练】尼科彻斯定理 (C语言代码)浏览:661 |
宏定义(C语言代码)浏览:451 |
不容易系列 (C语言代码)浏览:625 |
C语言考试练习题_一元二次方程 (C语言代码)浏览:472 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:891 |
【绝对值排序】 (C++代码)(利用两个库函数——abs()求绝对值 和 sort()快排)浏览:1190 |
【回文数(二)】 (C语言代码)浏览:551 |
WU-格式化数据输出 (C语言代码)浏览:1177 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:465 |
1113题解浏览:635 |