URI-1006 Solve

Average 2

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
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 MEDIA(average in Portuguese) according to the following example, with a blank space before and after the equal signal.
Input SamplesOutput Samples
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
Problem link: https://www.urionlinejudge.com.br/judge/en/problems/view/1006

Solution:

  • [tab]
    • C
      • #include<stdio.h>
        int main(void){
            float a,b,c,average;
            scanf("%f%f%f",&a,&b,&c);
            average=(a*2.0+b*3.0+c*5.0)/10.0;
            printf("MEDIA = %.1f\n",average);
            return 0;
        }
    • C++
      • #include <iostream>
        using namespace std;
        
        int main()
        {
         double a, b, c, media;
        
         cin >> a >> b >> c;
        
         media = (a/10 * 2) + (b/10 * 3) + (c/10 * 5);
        
         cout << "MEDIA = "<< fixed << setPrecision(1) << media << endl;
        
         return 0;
        }
3/Technology/post-list
Name

Codeforces,53,Problem Solve,90,Programming Tricks,1,URI,37,
ltr
item
DorHubs: URI-1006 Solve
URI-1006 Solve
https://resources.urionlinejudge.com.br/gallery/images/flags/br.gif
DorHubs
https://dorhubs.blogspot.com/2019/08/uri-1006-solve.html
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/2019/08/uri-1006-solve.html
true
9087637800571592252
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy