Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static int High = 1023;
  6.     public static int Low = 126;
  7.     public static float ComputeRain(float raw) => Math.Max(0, ((raw-Low)/(High-Low) * 100));
  8.     public static int Compute(int raw) => (int)Math.Round(ComputeRain(raw));
  9.     public static void Main()
  10.     {
  11.         Console.WriteLine(Compute(1023));
  12.         Console.WriteLine(Compute(500));
  13.         Console.WriteLine(Compute(133));
  14.         Console.WriteLine(Compute(0));
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement