0

Please explain how this code works:

using System; public class Program { public static void Main() { DateTime today = DateTime.Now; if (today.DayOfWeek == DayOfWeek.Monday) Console.WriteLine("Monday"); if (today.DayOfWeek == DayOfWeek.Sunday) Console.WriteLine("Sunday"); if (today.DayOfWeek == DayOfWeek.Tuesday) Console.WriteLine("Tuesday"); if (today.DayOfWeek == DayOfWeek.Wednesday) Console.WriteLine("Wednesday"); if (today.DayOfWeek == DayOfWeek.Saturday) Console.WriteLine("Saturday"); if (today.DayOfWeek == DayOfWeek.Thursday) Console.WriteLine("thursday"); if (today.DayOfWeek == DayOfWeek.Friday) Console.WriteLine("friday"); } }

31st May 2021, 8:31 PM
â€ŽŰŁÙ†ŰŻŰ±ÙŠÙ‡â€Ž
â€ŽŰŁÙ†ŰŻŰ±ÙŠÙ‡â€Ž - avatar
2 Answers
+ 1
the syntax is self-explanatory. all it does it finds whether the current day is equal to day of week
31st May 2021, 11:13 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
It finds current day and match with respective if statement to print day of a week
1st Jun 2021, 7:46 PM
Jadhav Swati
Jadhav Swati - avatar