2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
12
Task/Map-range/C-sharp/map-range.cs
Normal file
12
Task/Map-range/C-sharp/map-range.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public class MapRange
|
||||
{
|
||||
public static void Main() {
|
||||
foreach (int i in Enumerable.Range(0, 11))
|
||||
Console.WriteLine($"{i} maps to {Map(0, 10, -1, 0, i)}");
|
||||
}
|
||||
|
||||
static double Map(double a1, double a2, double b1, double b2, double s) => b1 + (s - a1) * (b2 - b1) / (a2 - a1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue