Advertisement
Guest User

Sum seconds

a guest
Sep 14th, 2016
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. int sec1 = int.Parse(Console.ReadLine());
  8. int sec2 = int.Parse(Console.ReadLine());
  9. int sec3 = int.Parse(Console.ReadLine());
  10. int secs = sec1 + sec2 + sec3;
  11. int mins = (sec1 + sec2 + sec3) / 60;
  12.  
  13. if (secs >= 0 && secs <= 59)
  14. {
  15. if (secs < 10)
  16. {
  17. Console.WriteLine("{0}:0{1}", mins, secs);
  18. }
  19. else
  20. {
  21. Console.WriteLine("{0}:{1}", mins, secs);
  22. }
  23. }
  24. else if (secs >= 60 && secs <= 119)
  25. {
  26. secs = secs - 60;
  27. if (secs < 10)
  28. {
  29. Console.WriteLine("{0}:0{1}", mins, secs);
  30. }
  31. else
  32. {
  33. Console.WriteLine("{0}:{1}", mins, secs);
  34. }
  35. }
  36. else if (secs >= 120 && secs <= 179)
  37. {
  38. secs = secs - 120;
  39. if (secs < 10)
  40. {
  41. Console.WriteLine("{0}:0{1}", mins, secs);
  42. }
  43. else
  44. {
  45. Console.WriteLine("{0}:{1}", mins, secs);
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement