Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MovieRatings
- {
- class Program
- {
- static void Main(string[] args)
- {
- int movieVolume = int.Parse(Console.ReadLine());
- double maxRating = 0;
- double minRating = 10;
- string maxMovie = "";
- string minMovie = "";
- double average = 0;
- for (int i = 0; i < movieVolume; i++)
- {
- string movie = Console.ReadLine();
- double rating = double.Parse(Console.ReadLine());
- if (rating > maxRating)
- {
- maxMovie = movie;
- maxRating = rating;
- }
- else if (rating < minRating)
- {
- minMovie = movie;
- minRating = rating;
- }
- average += rating / movieVolume;
- }
- Console.WriteLine($"{maxMovie} is with highest rating: {maxRating:F1}");
- Console.WriteLine($"{minMovie} is with lowest rating: {minRating:F1}");
- Console.WriteLine($"Average rating: {average:F1}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement