Advertisement
Qrist

Rounding Numbers

Apr 7th, 2020
178
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 GitHub
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             double[] arr = new double[] { 0.9, 1.5, 2.4, 2.5, 3.14 };
  11.             foreach (var item in arr)
  12.             {
  13.                 Console.WriteLine("{0}=={1}",item,Math.Round(item,MidpointRounding.AwayFromZero));
  14.             }    
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement