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 _05.Movie_Ratings
- {
- class Program
- {
- static void Main(string[] args)
- {
- var numFilm = int.Parse(Console.ReadLine());
- double max =double.MinValue;
- double min =double.MaxValue;
- string winer="";
- string loser="";
- double sum = 0;
- double counter=0;
- for (int i = 1; i <= numFilm; i++)
- {
- string imefilm = Console.ReadLine();
- double ocenka = double.Parse(Console.ReadLine());
- sum += ocenka;
- counter++;
- if (ocenka>=max)
- {
- max = ocenka;
- winer = imefilm;
- }
- if (ocenka<=min)
- {
- min = ocenka;
- loser = imefilm;
- }
- }
- double a = sum / counter;
- Console.WriteLine($"{winer} is with highest rating: {max}");
- Console.WriteLine($"{loser} is with lowest rating: {min}");
- Console.WriteLine($"Average rating: {a:f1}");
- }
- }
- }
Add Comment
Please, Sign In to add comment