Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<cmath>
- int main() {
- int n, f, sump = 0, sumo = 0, countp = 0, counto = 0;
- float srp=0, sro=0;
- scanf_s("%d", &n);
- for( int i = 1 ; i <= n; i++) {
- scanf_s("%d", &f);
- if (f > 0) {
- sump += f;
- countp += 1;
- }
- else {
- sumo += f;
- counto += 1;
- }
- }
- srp = sump / countp;
- sro = sumo / counto;
- printf("%d %d %d %d", sumo, counto, sump, countp);
- if (srp > abs(sro)) {
- printf("%f", srp);
- }
- else {
- printf("%f", sro);
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement