[URI Online Judge] – 1006 – Average 2

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 Input Sample 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 <cstdio>

int main(){
float a, b, c;
scanf(“%f”, &a);
scanf(“%f”, &b);
scanf(“%f”, &c);
printf(“MEDIA = %.1f\n”, (a * 2.0 + b * 3.0 + c * 5.0) / 10.0);
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s