Advertisement
angelneychev

01. Sum Seconds

Sep 26th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _45555
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             int num1 = int.Parse(Console.ReadLine());
  11.             int num2 = int.Parse(Console.ReadLine());
  12.             int num3 = int.Parse(Console.ReadLine());
  13.  
  14.             var seconds = num1 + num2 + num3;
  15.             var minutes = 0;
  16.  
  17.             if (seconds > 59)
  18.             {
  19.                 minutes++;
  20.                 seconds = seconds - 60;
  21.             }
  22.             if (seconds > 59)
  23.             {
  24.                 minutes++;
  25.                 seconds = seconds - 60;
  26.             }
  27.             if (seconds < 10)
  28.             {
  29.                 Console.WriteLine(minutes + ":" + "0" + seconds);
  30.             }
  31.             else
  32.             {
  33.               Console.WriteLine(minutes + ":" + seconds);
  34.             }
  35.         }
  36.      }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement