Advertisement
Spocoman

01. Sum Seconds

Nov 15th, 2021 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SumSeconds
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             int firstTime = int.Parse(Console.ReadLine());
  10.             int secondTime = int.Parse(Console.ReadLine());
  11.             int thirdTime = int.Parse(Console.ReadLine());
  12.             int total = firstTime + secondTime + thirdTime;
  13.             int minutes = total / 60;
  14.             int seconds = total % 60;
  15.  
  16.             if (seconds < 10)
  17.             {
  18.                 Console.WriteLine($"{minutes}:0{seconds}");
  19.             }
  20.             else
  21.             {
  22.                 Console.WriteLine($"{minutes}:{seconds}");
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement