Skip to content

Commit

Permalink
Solve Positives and Average in c
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Sep 20, 2024
1 parent af3edcb commit e8e8010
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions solutions/beecrowd/1064/1064.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <math.h>
#include <stdint.h>
#include <stdio.h>

int main() {
float n, s = 0;
int16_t c = 0;

while (scanf("%f", &n) != EOF) {
if (n > 0) {
s += n;
c++;
}
}

printf("%d valores positivos\n", c);
printf("%.1f\n", (float)(s / c));

return 0;
}

0 comments on commit e8e8010

Please sign in to comment.