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.

Solution
Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic
using System;

namespace _1005_Average_1
{
    class Program
    {
        static void Main(string[] args)
        {
            double A, B, MEDIA;
            A = Convert.ToDouble(Console.ReadLine());
            B = Convert.ToDouble(Console.ReadLine());
            MEDIA = ((A * 3.5 + B * 7.5) / (3.5 + 7.5));
            Console.WriteLine("MEDIA = " + MEDIA.ToString("f5"));

            Console.ReadKey();
        }
    }
}

1 Comments

Post a Comment

Previous Post Next Post