URI Online Judge Solution 1006 - Brain Muscles URI 1006
URI Online Judge Solution 1006☺ Average 2☺ URI
Online Judge Solution 1006
Before seeing the solution make sure that you
tried enough. Don’t paste the whole code, just find out the logic. If you stuck
in trouble, just inform me on comment.
![]() |
| Add caption |
URI Online Judge | 1006
Average 2
Read three values (variables A,
B and C), which are the three student's grades. Then, calculate the average,
considering that grade A has weight 2, grade B has weight 3 and the grade C
has weight 5. Consider that each grade can go from 0 to 10.0, always with one
decimal place.
Input
The input file contains 3
values of floating points with one digit after the decimal point.
Output
Print the message
"MEDIA"(average in Portuguese) and the student's average according
to the following example, with a blank space before and after the equal
signal.
|
|
Samples Input
|
Samples 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
|
URI Solution 1006 Average 2 Solution
in C:
|
#include <stdio.h>
int main()
{
double A,B,C,avg;
scanf("%lf %lf %lf",&A,&B,&C);
avg=((A)*(2)+(B)*(3)+(C)*(5))/(2+3+5);
printf("MEDIA = %.1lf\n",avg); return 0;
}

Popular
Tags
Videos
0 comments:
Post a Comment