P
P
ProblemBook.NET
Search…
⌃K
P
P
ProblemBook.NET
Search…
⌃K
ProblemBook.NET
LANGS
Задачник.NET
Math
«AugmentedAssignment» (Задача)
«Rounding1» (Задача)
«Overflow» (Решение)
«Overflow» (Задача)
«DivideByZero» (Решение)
«DivideByZero» (Задача)
«Eps» (Решение)
«DynamicIncrement» (Решение)
«Eps» (Задача)
«DynamicIncrement» (Задача)
«Rounding2» (Решение)
«AugmentedAssignment» (Решение)
«Rounding1» (Решение)
«Rounding2» (Задача)
Oop
ValueTypes
Strings
Linq
Multithreading
Summary
Введение
ProblemBook.NET
Attribution-NonCommercial-NoDerivatives 4.0 International
Powered By GitBook

«Rounding1» (Задача)

Что выведет следующий код?
Console.WriteLine(
"| Number | Round | Floor | Ceiling | Truncate | Format |");
foreach (var x in new[] { -2.9, -0.5, 0.3, 1.5, 2.5, 2.9 })
{
Console.WriteLine(string.Format(CultureInfo.InvariantCulture,
"| {0,6} | {1,5} | {2,5} | {3,7} | {4,8} | {0,6:N0} |",
x, Math.Round(x), Math.Floor(x),
Math.Ceiling(x), Math.Truncate(x)));
}
​Решение​
Previous
«AugmentedAssignment» (Задача)
Next
«Overflow» (Решение)
Last modified 3yr ago
Copy link