ss3434

цинема

Oct 31st, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _05.Movie_Ratings
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. var numFilm = int.Parse(Console.ReadLine());
  15. double max =double.MinValue;
  16. double min =double.MaxValue;
  17. string winer="";
  18. string loser="";
  19.  
  20. double sum = 0;
  21. double counter=0;
  22. for (int i = 1; i <= numFilm; i++)
  23. {
  24. string imefilm = Console.ReadLine();
  25.  
  26. double ocenka = double.Parse(Console.ReadLine());
  27. sum += ocenka;
  28. counter++;
  29. if (ocenka>=max)
  30. {
  31. max = ocenka;
  32. winer = imefilm;
  33. }
  34. if (ocenka<=min)
  35. {
  36. min = ocenka;
  37. loser = imefilm;
  38. }
  39. }
  40. double a = sum / counter;
  41. Console.WriteLine($"{winer} is with highest rating: {max}");
  42. Console.WriteLine($"{loser} is with lowest rating: {min}");
  43. Console.WriteLine($"Average rating: {a:f1}");
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment