veronikaaa86

Round

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