Problem Name: 1064 Positives and Average solution
Problem Number : URI - 1064 Positives and Average code
Online Judge : URI Online Judge Solution
Category: BeginnerProblem Number : URI - 1064 Positives and Average code
Online Judge : URI Online Judge Solution
Solution in C++
#include <cstdio>int main()
{
double n, ctr = 0;
double tmp = 0;
for(int i = 0; i < 6; ++i)
{
scanf("%lf", &n);
if(n > 0){
tmp += n;
ctr++;
}
}
printf("%.0lf valores positivos\n%.1lf\n", ctr, tmp/ctr);
return 0;
}
No comments:
Post a Comment
Thanks..