IvetValcheva

01. Sum Seconds

Jan 17th, 2022
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Demo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int first = int.Parse(Console.ReadLine());
  10.             int second = int.Parse(Console.ReadLine());
  11.             int third = int.Parse(Console.ReadLine());
  12.  
  13.             int time = first + second + third;
  14.  
  15.             int min = time / 60;
  16.             int sec = time % 60;
  17.  
  18.             if (sec < 10)
  19.             {
  20.                 Console.WriteLine($"{min}:0{sec}");
  21.             }
  22.             else
  23.             {
  24.                 Console.WriteLine($"{min}:{sec}");
  25.             }
  26.            
  27.         }
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment