Answer to Question #315120 in C# for Saphira

Question #315120

Create a console program that will perform the following:





Ask the user to enter five (5) grades





Compute the average of the grades





Round of the average using method of Math class




Example output:



Enter 5 grades separated by new Line.



90



83



87



98



93




The average is 90.2 and round off to 90.




1
Expert's answer
2022-03-21T12:36:14-0400
using System;


namespace MathApp


{
    class Program
    {
        static void Main(string[] args)
        {
            int [] Marks = new int [5];
            int Sum = 0;
            for (int i = 0; i < 5; ++i)
            {
                Console.WriteLine($"Enter {i + 1} mark");
                Marks[i] = int.Parse(Console.ReadLine());
                Sum += Marks[i];
            }
            Console.WriteLine($"The average is {(decimal)Sum/5} and round off to {Math.Round((decimal)Sum/5)}.");
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS