Table of Contents

Average 1

Adapted by Neilor Tonin, URI  BrazilTimelimit: 1

Read two floating points’ values of double precision A and B, corresponding to two student’s grades. After this, calculate the student’s average, considering that grade A has weight 3.5 and B has weight 7.5. Each grade can be from zero to ten, always with one digit after the decimal point. Don’t forget to print the end of line after the result, otherwise you will receive “Presentation Error”. Don’t forget the space before and after the equal sign.

Input

The input file contains 2 floating points’ values 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 with a blank space before and after the equal signal.

Input SamplesOutput Samples
5.0
7.1
MEDIA = 6.43182
0.0
7.1
MEDIA = 4.84091
10.0
10.0
MEDIA = 10.00000

Solution

#include <stdio.h>

int main()
{

    double A,B,media;
    scanf("%lf",&A);
    scanf("%lf",&B);

    media =(A * 3.5 + B * 7.5)/(3.5 + 7.5);
    printf("MEDIA = %.5lf\n",media);

    return 0;
}
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on whatsapp
WhatsApp
Share on email
Email
Md. Nurnobi Hosen
Md. Nurnobi Hosen

Student of Computer Science and Engineering at Daffodil International University,Main Campus ,Dhanmondi.
Web and App Developer also expart of wordpress customization

All Blog Posts »
Subscribe
Notify of
guest
2 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
oprolevorter
oprolevorter
December 4, 2019 12:18 PM

Some really choice content on this site, saved to favorites.

oprol evorter
oprol evorter
December 11, 2019 6:03 AM

Great write-up, I am regular visitor of one?¦s website, maintain up the nice operate, and It’s going to be a regular visitor for a lengthy time.

2
0
Would love your thoughts, please comment.x
()
x