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 _06.Coins
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int playedGames = int.Parse(Console.ReadLine());
- int sendGoals = int.Parse(Console.ReadLine());
- int receivedGoals = int.Parse(Console.ReadLine());
- int totalreceivedGoals = 0;
- int totalsendGoals = 0;
- int totalPoins = 0;
- int totalGoalDiff = 0;
- int points = 0;
- int counter = 1;
- int goalDiff = 0;
- while (counter <= playedGames)
- {
- if (receivedGoals < sendGoals)
- {
- points = points + 3;
- goalDiff = sendGoals - receivedGoals;
- }
- else if (receivedGoals > sendGoals)
- {
- points = points + 0;
- goalDiff = receivedGoals - sendGoals;
- }
- else
- {
- points = points + 1;
- goalDiff = 0;
- }
- totalreceivedGoals = totalreceivedGoals + receivedGoals;
- totalsendGoals = totalsendGoals + sendGoals;
- totalGoalDiff = totalGoalDiff + goalDiff;
- totalPoins = points;
- counter++;
- if (counter <= playedGames)
- {
- sendGoals = int.Parse(Console.ReadLine());
- receivedGoals = int.Parse(Console.ReadLine());
- }
- }
- if (totalsendGoals >= totalreceivedGoals)
- {
- Console.WriteLine($"{name} has finished the group phase with {totalPoins} points.");
- Console.WriteLine($"Goal difference: {totalGoalDiff}");
- }
- else
- {
- Console.WriteLine($"{name} has been eliminated from the group phase.");
- Console.WriteLine($"Goal difference: {totalsendGoals - totalreceivedGoals}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment