Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05._Movie_Ratings
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numMovie = int.Parse(Console.ReadLine());
- double maxRatig = Double.MinValue;
- string MoviewhitMaxRating = "";
- double minRatig = Double.MaxValue;
- string MoviewhitMinRating = "";
- double Sum = 0;
- for (int i = 1; i <= numMovie; i++)
- {
- string Movie = Console.ReadLine();
- double Rating = double.Parse(Console.ReadLine());
- Sum += Rating;
- if (Rating > maxRatig)
- {
- maxRatig = Rating;
- MoviewhitMaxRating = Movie;
- }
- if (Rating < minRatig)
- {
- minRatig = Rating;
- MoviewhitMinRating = Movie;
- }
- }
- double average = Sum / numMovie;
- Console.WriteLine($"{MoviewhitMaxRating} is with highest rating: {maxRatig}");
- Console.WriteLine($"{MoviewhitMinRating} is with lowest rating: {minRatig}");
- Console.WriteLine($"Average rating: {average:f1}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement