[URI Online Judge] – 1005 – Average 1

Make a simple program that read two floating numbers corresponding to two tests for a student. After, calculate the average between them, considering that the first number has 3.5 weight and the second one have 7.5 weight. Each number can be from zero to ten, always with one digit after the decimal point. Don’t forget to print end line after the result otherwise you will get “Presentation Error”. Don’t forget the space before and after the equal sign.

Input

The input file will contain 2 floating-point numbers with one digit after the decimal point.

Output

Print MEDIA(average in portuguese) according to the following example, with 5 digits after the decimal point and a blank space before and after the equal signal.

Sample Inputs Sample Outputs
5.0
7.1
MEDIA = 6.43182
0.0
7.1
MEDIA = 4.84091
10.0
10.0
MEDIA = 10.00000

Solution:

#include <cstdio>

int main(){
float a, b;
scanf(“%f”, &a);
scanf(“%f”, &b);
printf(“MEDIA = %.5f\n”, (a * 3.5 + b * 7.5) / 11.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