Advertisement
Spocoman

Football Results

Nov 26th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FootballResults
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             int won = 0;
  10.             int lost = 0;
  11.             int drawn = 0;
  12.             for (int i = 0; i < 3; i++)
  13.             {
  14.                 string game = Console.ReadLine();
  15.                 int teamOneResult = (int)game[0];
  16.                 int teamTwoResult = (int)game[2];
  17.  
  18.                 if (teamOneResult > teamTwoResult)
  19.                 {
  20.                     won++;
  21.                 }
  22.                 else if (teamTwoResult > teamOneResult)
  23.                 {
  24.                     lost++;
  25.                 }
  26.                 else
  27.                 {
  28.                     drawn++;
  29.                 }
  30.             }
  31.             Console.WriteLine($"Team won { won} games.");
  32.             Console.WriteLine($"Team lost { lost} games.");
  33.             Console.WriteLine($"Drawn games: { drawn}");
  34.         }
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement