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 ConsoleApplication10
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter the amount of students in the class.");
- int amount = int.Parse(Console.ReadLine());
- string[] studentname = new string[amount];
- double[] grades = new double[amount];
- double highestGrade=0;
- double avergaeGrade;
- double totalgrades = 0;
- string highestgradestudent= "";
- for(int i=0; i<amount;i++)
- {
- Console.WriteLine("Enter the name of student{0} .", i+1);
- studentname[i] = Console.ReadLine();
- Console.WriteLine("Enter the grades of student{0} .", i + 1);
- grades[i] = double.Parse(Console.ReadLine());
- totalgrades = totalgrades + grades[i];
- if (grades[i] > highestGrade)
- {
- highestGrade = grades[i];
- highestgradestudent = studentname[i];
- }
- }
- avergaeGrade = totalgrades / amount;
- Console.WriteLine("Average of student's grades are: " + avergaeGrade);
- //highestGrade = grades.Max();
- Console.WriteLine("Highest grades are: " + highestGrade + " of " + highestgradestudent);
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment