Advertisement
PIBogdanov

zad

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