IvetValcheva

Sum Seconds

Apr 12th, 2021
223
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 ConsoleApp3
  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 sum = first + second + third;
  14.  
  15.             int min = sum / 60;
  16.             int sec = sum % 60;
  17.  
  18.             Console.Write(min);
  19.  
  20.             if (sec < 10)
  21.             {
  22.                 Console.WriteLine(":0"+sec);
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine(":"+sec);
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment