Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Program{
- public static uint CheckInterval(uint value, uint min, uint max){ // ограничить число диапазоном
- return (value < min) ? min : (value > max) ? max : value;
- }
- public static void Main() {
- Console.Write("Год:");
- uint y = uint.Parse(Console.ReadLine());
- Console.Write("Месяц:");
- uint m = uint.Parse(Console.ReadLine());
- Console.Write("День:");
- uint d = uint.Parse(Console.ReadLine());
- y = CheckInterval(y, 1, 2100);
- m = CheckInterval(m, 1, 12);
- d = CheckInterval(d, 1, 31);
- uint time = 0 | y << 16 | m << 8 | d;
- Console.WriteLine(Convert.ToString(time, 2));
- Console.WriteLine(y.ToString() +":" + m.ToString() +":" + d.ToString() );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement