Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
115
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.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _3.P03_Rounding_numbers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             string numbers = Console.ReadLine(); // Вход 0.9 1.5 2.4 2.5 3.14
  15.             string[] num = numbers.Split();
  16.             double[] arr = new double[num.Length];
  17.             for (int i = 0; i < arr.Length; i++)
  18.             {
  19.                 arr[i] = double.Parse(num[i]);
  20.                 Console.WriteLine($"{num[i]} => {Math.Round(arr[i])}"); // Изход 0.9 => 11.5 => 22.4 => 22.5 => 33.14 => 3
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement