optybg

Sum_Seconds

Sep 13th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Sum_Seconds
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var runer1 = int.Parse(Console.ReadLine());
  14.             var runer2 = int.Parse(Console.ReadLine());
  15.             var runer3 = int.Parse(Console.ReadLine());
  16.  
  17.             var totalSec = runer1 + runer2 + runer3;
  18.  
  19.             int totalMin = totalSec / 60;
  20.             int seconds = totalSec % 60;
  21.  
  22.             if (seconds < 10)
  23.             {
  24.                 Console.WriteLine("{0}:0{1}", totalMin, seconds);
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine("{0}:{1}", totalMin, seconds);
  29.             }
  30.                    
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment