Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _03.RoundingNumbers
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- double[] input = Console.ReadLine()
- .Split(" ")
- .Select(double.Parse)
- .ToArray();
- for (int i = 0; i < input.Length; i++)
- {
- var roundedVal = Math.Round(input[i], 0, MidpointRounding.AwayFromZero).ToString();
- if (roundedVal == "-0")
- {
- roundedVal = "0";
- }
- Console.WriteLine($"{input[i]} => {roundedVal}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement