Advertisement
mihael03

Sum_Seconds

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