Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CountLechtures
- {
- class CountLectures
- {
- static void Main(string[] args)
- {
- Console.Write("Enter starting date: ");
- var startingDate = DateTime.Parse(Console.ReadLine());
- Console.Write("Enter end date: ");
- var endDate = DateTime.Parse(Console.ReadLine());
- Console.Write("Day of the lectuce: ");
- string day = Console.ReadLine();
- DayOfWeek dayw = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), day);
- int maxDaysCount = 0;
- while (startingDate <= endDate)
- {
- if (startingDate.DayOfWeek == dayw)
- {
- maxDaysCount++;
- }
- startingDate = startingDate.AddDays(1);
- }
- Console.WriteLine(maxDaysCount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement