Advertisement
IvetValcheva

6. Oscars

Oct 2nd, 2022
1,156
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _6._Oscars
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //1. Четем от конзолата име на актьора
  10.             string actorName = Console.ReadLine();
  11.             //2. Четем от конзолата първоначални точки
  12.             double points = double.Parse(Console.ReadLine());
  13.             //3. Четем от конзолата брой оценяващи - n
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             string assessorName;
  17.             double assessorPoints;
  18.  
  19.             //4. Пускаме цикъл, който да се изпълнява за всеки 1 оценяващ
  20.             for (int i = 1; i <= n; i++)
  21.             {
  22.                 // => за всеки оценяващ четем: името му и точките, които дава
  23.                 assessorName = Console.ReadLine();
  24.                 assessorPoints = double.Parse(Console.ReadLine());
  25.  
  26.                 // => добавяме точките към общия брой точки
  27.                 points = points + (assessorName.Length*assessorPoints/2);
  28.                 //points += (assessorName.Length*assessorPoints/2);
  29.  
  30.                 // => проверяваме дали актьора е получил достатъчно точки (1250.5)
  31.                 if (points>=1250.5)
  32.                 {
  33.                     Console.WriteLine($"Congratulations, {actorName} got a nominee for leading role with {points:f1}!");
  34.                     break;
  35.                 }
  36.             }
  37.  
  38.             //5. Проверяваме дали точките са по-малко от 1250.5
  39.             if (points < 1250.5)
  40.             {
  41.                 Console.WriteLine($"Sorry, {actorName} you need {1250.5-points:f1} more!");
  42.             }
  43.         }
  44.     }
  45. }
  46.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement