-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy path1064.cpp
More file actions
45 lines (40 loc) · 744 Bytes
/
1064.cpp
File metadata and controls
45 lines (40 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <stdio.h>
int main(){
float a,b,c,d,e,f;
float post = 0.0;
float soma = 0.0;
std::cin >> a;
if(a >= 0.0){
post += 1.0;
soma += a;
}
std::cin >> b;
if(b >= 0.0){
post += 1.0;
soma += b;
}
std::cin >> c;
if(c >= 0.0){
post += 1.0;
soma += c;
}
std::cin >> d;
if(d >= 0.0){
post += 1.0;
soma += d;
}
std::cin >> e;
if(e >= 0.0){
post += 1.0;
soma += e;
}
std::cin >> f;
if(f >= 0.0){
post += 1.0;
soma += f;
}
printf("%.0f valores positivos\n", post);
printf("%.1f\n", soma/post);
return 0;
}