Advertisement
desislava_topuzakova

01. Clock

Jul 9th, 2022
900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace P01.Clock
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             //Older version -> this will not work
  11.             //Console.WriteLine($"Кирилица на конзолата!");
  12.             //Outer -> Hour
  13.             //Inner -> Minutes
  14.             //For each hour -> loop through all minutes inside the hour
  15.  
  16.             for (int hour = 0; hour <= 23; hour++)
  17.             {
  18.                 for (int minutes = 0; minutes <= 59; minutes++)
  19.                 {
  20.                     for (int seconds = 0; seconds <= 59; seconds++)
  21.                     {
  22.                         //Delay 10-15-100ms
  23.                         Console.WriteLine($"{hour:d2}:{minutes:d2}:{seconds:d2}");
  24.  
  25.                         //1 op -> 1-10ms
  26.                         Thread.Sleep(1000);
  27.                     }
  28.                 }
  29.                 //Speaker -> produce sound
  30.                 //Console.WriteLine($"Another hour has just passed! Tu-tu!");
  31.             }
  32.         }
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement