DEV Community

Ivan Ivanov
Ivan Ivanov

Posted on

1. Sum Seconds

using System;

namespace Sum_Seconds
{
internal class Program
{
    static void Main(string[] args)
    {
        int firstTime = int.Parse(Console.ReadLine());
        int secondTime = int.Parse(Console.ReadLine());
        int thirdTime = int.Parse(Console.ReadLine());

        int totalTime = firstTime + secondTime + thirdTime;

        int minutes = totalTime / 60;
        int seconds = totalTime % 60;

        if (seconds < 10)
        {
            Console.WriteLine($"{minutes}:0{seconds}");
        }
        else
        {
            Console.WriteLine($"{minutes}:{seconds}");
        }
    }
}
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)