fork(162) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. var roundedA = Math.Round(1.1, 0); // Output: 1
  8. var roundedB = Math.Round(1.5, 0, MidpointRounding.AwayFromZero); // Output: 2
  9. var roundedC = Math.Round(1.9, 0); // Output: 2
  10. var roundedD = Math.Round(2.5, 0); // Output: 2
  11. var roundedE = Math.Round(2.5, 0, MidpointRounding.AwayFromZero); // Output: 3
  12. var roundedF = Math.Round(3.49, 0, MidpointRounding.AwayFromZero); // Output: 3
  13. Console.WriteLine("A: " + roundedA);
  14. Console.WriteLine("B: " + roundedB);
  15. Console.WriteLine("C: " + roundedC);
  16. Console.WriteLine("D: " + roundedD);
  17. Console.WriteLine("E: " + roundedE);
  18. Console.WriteLine("F: " + roundedF);
  19. }
  20. }
Success #stdin #stdout 0.01s 131072KB
stdin
Standard input is empty
stdout
A: 1
B: 2
C: 2
D: 2
E: 3
F: 3