Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Water_dispenser
- {
- class Program
- {
- static void Main()
- {
- var n = 0d;
- bool f = false;
- var s = "";
- while (s != "END")
- {
- while (!f)
- {
- f = double.TryParse(s = Console.ReadLine(), out n);
- if (s == "END") break;
- }
- if (f)
- {
- Console.WriteLine($"Math.Round(n, 2, AWF 0)={Math.Round(n, 2,MidpointRounding.AwayFromZero)}");
- Console.WriteLine($"Math.Round(n, 2, To even)={Math.Round(n, 2,MidpointRounding.ToEven)}");
- Console.WriteLine($"Math.Round(n, 2)={Math.Round(n, 2)}");
- Console.WriteLine($"Math.Round(n+1, 2)={Math.Round(n + 1, 2)}");
- Console.WriteLine($"Math.Round(n-1, 2)={Math.Round(n - 1, 2)}");
- Console.WriteLine($"Math.Round((n+1-1), 2)={Math.Round((n + 1 - 1), 2)}");
- Console.WriteLine($"n:F2={n:F2}");
- Console.WriteLine($"n+1:F2={n+1:F2}");
- f = !f;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement