Advertisement
elena1234

Simple way to use func

Apr 12th, 2021
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace MathOperations
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Func<int, double> getValue = x => Math.Log(x % 10 - 2);
  11.  
  12.             var numbers = Enumerable.Range(0, 100).Where(x => getValue(x) >= 1 && getValue(x) <= 2);
  13.             Console.WriteLine(string.Join(" ", numbers));
  14.         }
  15.     }
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement