Advertisement
tanya_zheleva

Day of Week

Jan 30th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExamPreparation
  4. {
  5.     public enum DaysOfWeek
  6.     {
  7.         Monday = 1,
  8.         Tuesday,
  9.         Wednesday,
  10.         Thursday,
  11.         Friday,
  12.         Saturday,
  13.         Sunday
  14.     }
  15.  
  16.     class Startup
  17.     {
  18.         static void Main()
  19.         {
  20.             int day = int.Parse(Console.ReadLine());
  21.  
  22.             if (day < 1 || day > 7)
  23.             {
  24.                 Console.WriteLine("Invalid Day!");
  25.             }
  26.             else
  27.             {
  28.                 DaysOfWeek weekDay = (DaysOfWeek)day;
  29.                 Console.WriteLine(weekDay);
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement