Advertisement
lightxx

Round to Even

Nov 15th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace RoundToEven {
  4.     class Program {
  5.         static void Main(string[] args) {
  6.             double[] numbers = { 12.5000, 12.45, 12.4, 12.6, 12.55 };
  7.             foreach (var number in numbers) {
  8.                 Console.WriteLine("{0} \t wird zu {1}!", number, Math.Round(number, MidpointRounding.ToEven));
  9.             }
  10.             Console.ReadLine();
  11.         }
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement