nvnnaidenov

SumSeconds - Chapter 3.0

Feb 10th, 2022
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. //Task 007, Chapter 3.0
  2. using System;
  3.  
  4. public class SumSeconds
  5. {
  6.     static void Main()
  7.     {
  8.         int firstCompetitor = int.Parse(Console.ReadLine());
  9.         int secondCompetitor = int.Parse(Console.ReadLine());
  10.         int thirdCompetitor = int.Parse(Console.ReadLine());
  11.  
  12.         int seconds = firstCompetitor + secondCompetitor + thirdCompetitor;
  13.         int minutes = 0;
  14.  
  15.         if(seconds > 59)
  16.         {
  17.             minutes++;
  18.             seconds -= 60;
  19.         }
  20.         if (seconds > 59)
  21.         {
  22.             minutes++;
  23.             seconds -= 60;
  24.         }
  25.         if(seconds < 10)
  26.         {
  27.             Console.WriteLine(minutes + ":" + "0" + seconds);
  28.         }
  29.         else
  30.         {
  31.             Console.WriteLine(minutes + ":" + seconds);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment