Advertisement
Spocoman

03. Rounding Numbers

Jan 20th, 2022
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace RoundingNumbers
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             double[] arr = Console.ReadLine().Split().Select(double.Parse).ToArray();
  11.  
  12.             for (int i = 0; i < arr.Length; i++)
  13.             {
  14.                 Console.WriteLine($"{Convert.ToDecimal(arr[i])} => {Math.Round(Convert.ToDecimal(arr[i]), MidpointRounding.AwayFromZero)}");
  15.             }
  16.         }
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement