Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DayOfWeek
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] week = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
- int day = int.Parse(Console.ReadLine());
- if (day > 0 && day < 8)
- {
- Console.WriteLine(week[day - 1]);
- }
- else
- {
- Console.WriteLine("Invalid day!");
- }
- }
- }
- }
- Тарикатско решение:
- using System;
- namespace DayOfWeek
- {
- class Program
- {
- static void Main(string[] args)
- {
- int day = int.Parse(Console.ReadLine());
- Console.WriteLine(day >= 0 && day <= 7 ? new string[]{ "Invalid day!", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}[day] : "Invalid day!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement