kirililchev3

Rounding Nums

Jun 3rd, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. namespace Rounding_Numbers
  2. {
  3.     using System;
  4.  
  5.     public class Rounding_Numbers
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             string input = Console.ReadLine();
  10.             string[] stringNums = input.Split();
  11.             double[] numbers = new double[stringNums.Length];
  12.  
  13.             for (int i = 0; i < numbers.Length; i++)
  14.             {
  15.                 numbers[i] = double.Parse(stringNums[i]);
  16.             }
  17.  
  18.             for (int i = 0; i < numbers.Length; i++)
  19.             {
  20.                 Console.WriteLine("{0} => {1}", numbers[i], Math.Round(numbers[i], MidpointRounding.AwayFromZero));
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment