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.

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 _1006_Average_2

{

    class Program

    {

        static void Main(string[] args)

        {

            double ABCMEDIA;

            A = Convert.ToDouble(Console.ReadLine());

            B = Convert.ToDouble(Console.ReadLine());

            C = Convert.ToDouble(Console.ReadLine());

            MEDIA = ((A * 2 + B * 3 + C * 5) / (2 + 3 + 5));

            Console.WriteLine("MEDIA = " + MEDIA.ToString("f1"));

 

            Console.ReadKey();

        }

    }

}


Post a Comment

Previous Post Next Post