TOPIC

Soma == 0 - C

Kitkat asked 2 years ago

c

//URI - 1079*/
/*Médias ponderadas*/

#include<stdio.h>
#include<stdlib.h>

#define p1 2
#define p2 3
#define p3 5

int main(){
  int N, i;
  double n1, n2, n3, med=0;
  scanf("%d", &N);

  for(i=0; i<N; i++){
    scanf("%1lf %1lf %1lf", &n1, &n2, &n3);

    med = ((n1*p1)+ (n2*p2) +(n3*p3))/ (p1+p2+p3);
    }

      printf("%.1lf\n", med);

return 0;
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.