madeofglass

Untitled

Feb 18th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05.TennisRanklist
  4. {
  5.     class TennisRanklist
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double tours = double.Parse(Console.ReadLine());
  10.             double points = double.Parse(Console.ReadLine());
  11.  
  12.  
  13.             double newPoints = 0;
  14.             double allPoints = 0;
  15.             double average = 0;
  16.             double win = 0;
  17.             double percent = 0;
  18.  
  19.  
  20.             for (int i = 1; i <= tours; i++)
  21.             {
  22.                 string level = Console.ReadLine();
  23.  
  24.                 if (level == "W")
  25.                 {
  26.                     newPoints += 2000;
  27.                     win++;
  28.                 }
  29.                 else if (level == "F")
  30.                 {
  31.                     newPoints += 1200;
  32.                 }
  33.                 else if (level == "SF")
  34.                 {
  35.                     newPoints += 720;
  36.                 }
  37.  
  38.                 allPoints = newPoints + points;
  39.                 average = Math.Floor(newPoints / tours);
  40.                 percent = (win / tours) * 100;
  41.                 //Console.WriteLine(win);
  42.                 //Console.WriteLine(percent);
  43.                
  44.             }
  45.            
  46.             Console.WriteLine($"Final points: {allPoints}");
  47.             Console.WriteLine($"Average points: {average}");
  48.             Console.WriteLine($"{percent:f2}%");
  49.         }
  50.     }
  51. }
Add Comment
Please, Sign In to add comment