Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Loops
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Enter number of grades: ");
- int n = int.Parse(Console.ReadLine());
- double sum = 0;
- double max = double.MinValue;
- double min = double.MaxValue;
- for (int i = 1; i <= n; i++)
- {
- Console.Write($"Enter grade {i}: ");
- double grade = double.Parse(Console.ReadLine());
- sum += grade;
- if (grade < min)
- {
- min = grade;
- }
- if (grade > max)
- {
- max = grade;
- }
- }
- // Console.WriteLine($"Sum = {sum}");
- Console.WriteLine($"Min grade = {min:F2}");
- Console.WriteLine($"Max grade = {max:F2}");
- double average = sum / n;
- string words = "";
- if (average < 3.00)
- {
- words = "Poor";
- }
- else if (average < 3.50)
- {
- words = "Average";
- }
- else if (average < 4.50)
- {
- words = "Good";
- }
- else if (average < 5.50)
- {
- words = "Very good";
- }
- else
- {
- words = "Excellent";
- }
- Console.WriteLine($"Average grade = {words} ({average:F2})");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement