NelIfandieva

DayOfWeek_withArray

Oct 29th, 2019
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ConsoleApp210
  5. {
  6.     class Program
  7.     {
  8.         static void Main()
  9.         {
  10.             int num = int.Parse(Console.ReadLine());
  11.  
  12.             string[] daysOfWeek = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
  13.  
  14.             if(num >= 1 && num <= 7)
  15.             {
  16.                 Console.Write(daysOfWeek[num - 1]);
  17.             }
  18.             else
  19.             {
  20.                 Console.Write("Invalid day!");
  21.             }
  22.         }
  23.     }
  24. }
RAW Paste Data