参考代码:
#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 人评分
WU-蓝桥杯算法提高VIP-勾股数 (C++代码)浏览:1592 |
【绝对值排序】 (C语言代码)浏览:820 |
蚂蚁感冒 (C语言代码)浏览:1319 |
A+B for Input-Output Practice (V) (C语言代码)浏览:459 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:534 |
字符串的输入输出处理 (C语言代码)浏览:984 |
整除问题 (C语言代码)浏览:518 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:403 |
小O的数字 (C语言代码)浏览:1406 |
字符删除 (C语言代码)浏览:715 |