Advertisement
gospod1978

Day of week

Oct 4th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2.  
  3. namespace arraySeptember
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string[] days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
  10.             int day = int.Parse(Console.ReadLine());
  11.  
  12.             if (day >= 1 && day <=7)
  13.             {
  14.                 Console.WriteLine(days[day - 1]);
  15.             }
  16.             else
  17.             {
  18.                 Console.WriteLine("Invalid day!");
  19.             }
  20.  
  21.  
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement