Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._Sum_Seconds
- {
- class Program
- {
- static void Main(string[] args)
- {
- //1. времената на тримата - OK
- //2. сумираме времената => общо време = време1 + време2 + време3 - OK
- //3. преобразуваме общо време в мин и сек - OK
- // мин = общо време / 60
- // сек = общо време % 60
- //4. принтираме
- //ако секундите са едноцифрено число -> минути:0секунди
- //ако секундите са двуцифрено число -> минути:секунди
- int time1 = int.Parse(Console.ReadLine());
- int time2 = int.Parse(Console.ReadLine());
- int time3 = int.Parse(Console.ReadLine());
- int totalTime = time1 + time2 + time3; //общо време в секунди
- int minutes = totalTime / 60;
- int seconds = totalTime % 60;
- if (seconds < 10)
- {
- Console.WriteLine($"{minutes}:0{seconds}");
- }
- else //seconds >= 10
- {
- Console.WriteLine($"{minutes}:{seconds}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment