Answer to Question #316580 in C# for Shines

Question #316580

Create console programs:




Example output:




Enter 5 grades:



90



83



87



98



93



The average is 90.2 and round off to 90.





1
Expert's answer
2022-03-24T01:40:05-0400
using System;
using System.Linq;
namespace Average
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter marks");

            string[] arr = Console.ReadLine().Split(' ');

            int[] intArr = new int[arr.Length];

            for (int i = 0; i < arr.Length; i++)
            {
                intArr[i] = int.Parse(arr[i]);
            }

            double avg = Queryable.Average(intArr.AsQueryable());
            Console.WriteLine("Average " + avg+ " round off to " + Convert.ToInt32(avg));

            Console.ReadLine();
        }
    }
}

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