Advertisement
plamen27

Sum Seconds

Jul 27th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 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_best
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var t1 = int.Parse(Console.ReadLine());
  14. var t2 = int.Parse(Console.ReadLine());
  15. var t3 = int.Parse(Console.ReadLine());
  16. var min = 0;
  17.  
  18. int sec = t1 + t2 + t3;
  19.  
  20. if ((sec > 59) && (sec <= 119))
  21. {
  22. min++;
  23. sec = sec - 60;
  24. }
  25. if ((sec >= 120) && (sec <= 179))
  26. {
  27. min = 2;
  28. sec = sec - 120;
  29. }
  30. if (sec < 10)
  31. {
  32. Console.WriteLine(min + ":" +"0" + sec);
  33. }
  34. else
  35. {
  36. Console.WriteLine(min + ":" + sec);
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement