Advertisement
Stan0033

Untitled

Jun 17th, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. namespace apps
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. //rounding numbebrs
  10.  
  11. string text = Console.ReadLine();
  12. int total = 0;
  13.  
  14. string[] Separated = text.Split(' ');
  15. double[] Nums = new double[Separated.Length];
  16. for (int i = 0; i < Separated.Length; i++)
  17. {
  18. Nums[i] = Convert.ToDouble(Separated[i]);
  19.  
  20.  
  21.  
  22.  
  23.  
  24. Nums[i] = Math.Round(Nums[i], MidpointRounding.AwayFromZero);
  25.  
  26.  
  27. if (Nums[i] == -0) { Nums[i] = 0; }
  28.  
  29. Console.WriteLine($"{Separated[i]} => {Nums[i]}");
  30. }
  31.  
  32.  
  33.  
  34.  
  35. }
  36.  
  37.  
  38. }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement