Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- using System.Linq;
- public class Timer
- {
- static void Main()
- {
- int interval = Int32.Parse(Console.ReadLine());
- Stopwatch sw = new Stopwatch();
- sw.Start();
- Func<int, bool> sleep = (x) =>
- {
- if (x * 1000 == sw.ElapsedMilliseconds)
- return true;
- else
- return false;
- };
- while (true)
- {
- if (sleep(interval) == true)
- {
- Console.WriteLine("surprise");
- sw.Restart();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement