Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. namespace ConsoleApplication2
  7. {
  8.     internal class Program
  9.     {
  10.         public static void Main(string[] args)
  11.         {
  12.             var dateTime = new DateTime();
  13.  
  14.  
  15.             var dateTimes = new List<DateTime>();
  16.             dateTimes.Add(Convert.ToDateTime("2019-05-05"));
  17.             dateTimes.Add(Convert.ToDateTime("2018-01-05"));
  18.             dateTimes.Add(Convert.ToDateTime("2020-02-21"));
  19.  
  20.             var SredniRok = dateTimes.Select(x => x.Year).Average();
  21.             var IloscPiatkow = dateTimes.Count(x => x.DayOfWeek == DayOfWeek.Friday);
  22.  
  23.             Console.WriteLine("sredni rok to : " + SredniRok);
  24.             Console.WriteLine("ilosc piatkow to : " + IloscPiatkow);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement