VelizarAvramov

05. Rounding Numbers

Nov 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _05._Rounding_Numbers
  5. {
  6.     class RoundNumbers
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             double[] arrayNum = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
  11.  
  12.             foreach (var item in arrayNum)
  13.             {
  14.                 double rounded = Math.Round(item, MidpointRounding.AwayFromZero);
  15.                 Console.WriteLine($"{item} => {rounded}");
  16.             }
  17.         }
  18.     }
  19. }
Add Comment
Please, Sign In to add comment