Teo_Yanchev

RoundingNumbers - C# Fundamentals

Sep 6th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _3.RoundingNumbers
  5. {
  6. class RoundingNumbers
  7. {
  8. static void Main(string[] args)
  9. {
  10. double[] numbers = Console.ReadLine()
  11. .Split()
  12. .Select(double.Parse)
  13. .ToArray();
  14. int numbersLength = numbers.Length;
  15.  
  16.  
  17. for (int i = 0; i < numbersLength; i++)
  18. {
  19. int arrayNumbers = (int)Math.Round(numbers[i], MidpointRounding.AwayFromZero);
  20. Console.WriteLine($"{numbers[i]} => {arrayNumbers}");
  21. }
  22. }
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment