tanya_zheleva

Rounding

Jan 30th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ExamPreparation
  5. {
  6.     class Startup
  7.     {
  8.         static void Main()
  9.         {
  10.             double[] numbers = Console.ReadLine()
  11.                 .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
  12.                 .Select(double.Parse)
  13.                 .ToArray();
  14.          
  15.             foreach (var number in numbers)
  16.             {
  17.                 Console.WriteLine($"{number} => {Math.Round(number, MidpointRounding.AwayFromZero)}");
  18.             }
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment