deyanivanov966

CONDITIONAL STATEMENTS - EXERCISE 01. Sum Seconds

Apr 17th, 2021 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Nums1_10
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int time1 = int.Parse(Console.ReadLine());
  10.             int time2 = int.Parse(Console.ReadLine());
  11.             int time3 = int.Parse(Console.ReadLine());
  12.  
  13.             int totalTime = time1 + time2 + time3;
  14.             int minutes = totalTime / 60;
  15.             int seconds = totalTime % 60;
  16.  
  17.             if (seconds<10)
  18.             {
  19.                 Console.WriteLine($"{minutes}:0{seconds}");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"{minutes}:{seconds}");
  24.             }
  25.  
  26.  
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment