Advertisement
nevenailievaa

01.SumSeconds

Nov 10th, 2024
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. //Input
  2. int firstPlayerTime = int.Parse(Console.ReadLine());
  3. int secondPlayerTime = int.Parse(Console.ReadLine());
  4. int thirdPlayerTime = int.Parse(Console.ReadLine());
  5.  
  6. //Calculations
  7. int timeInSeconds = firstPlayerTime + secondPlayerTime + thirdPlayerTime;
  8. int minutes = timeInSeconds / 60;
  9. int seconds = timeInSeconds % 60;
  10.  
  11. //Output
  12. if (seconds < 10)
  13. {
  14.     Console.WriteLine($"{minutes}:0{seconds}");
  15. }
  16. else
  17. {
  18.     Console.WriteLine($"{minutes}:{seconds}");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement