VelizarAvramov

Sum Seconds

Mar 21st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 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 SumSportSec
  8. {
  9.     class Marathon
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var sec1 = int.Parse(Console.ReadLine());
  14.             var sec2 = int.Parse(Console.ReadLine());
  15.             var sec3 = int.Parse(Console.ReadLine());
  16.  
  17.             var secs = sec1 + sec2 + sec3;
  18.             var mins = 0;
  19.             if (secs > 59)
  20.             {
  21.                 mins++;
  22.                 secs = secs - 60;
  23.             }
  24.             if (secs > 59)
  25.             {
  26.                 mins++;
  27.                 secs = secs - 60;
  28.             }
  29.             Console.WriteLine("{0}:{1:00}", mins,secs);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment