Wednesday, December 2, 2015

Uri problem 1006 solve

Problem :

Average 2

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read three numbers (variables A, B and C), which are the test scores of a student. Then, calculate the average, knowing that the note A has a weight of 2, the note B has a weight of 3 and the note C has a weight of 5. Consider that each note can go from 0 to 10.0, always with one decimal place.

Input

The input file contains 3 floating-point numbers with one digit after the decimal point.

Output

Print MEDIA(average in portuguese) according to the following example, with a blank space before and after the equal signal.
Sample InputSample Output
5.0
6.0
7.0
MEDIA = 6.3
5.0
10.0
10.0
MEDIA = 9.0
10.0
10.0
5.0
MEDIA = 7.5

Solution:


#include <stdio.h>
  
int main() {
  
 float A , B , C , MEDIA ;
    scanf("%f %f %f",&A , &B ,&C);
    MEDIA= ((A*2)+(B*3)+(C*5))/(2+3+5);
    printf("MEDIA = %.1f\n",MEDIA);
 
  
    return 0;
}

No comments:

Post a Comment