View Problem

Format a decimal number

Format the number 7/8 as a decimal with 2 places: 0.88
ExpandDiskEdit
java 1.5 or later
String formatted = String.format("%3.2f", 7./8.);
DiskEdit
csharp
public class FormatDecimal {
public static void Main() {
decimal result = decimal.Round( 7 / 8m, 2);
System.Console.WriteLine(result);
}
}

Submit a new solution for java or csharp
There are 29 other solutions in additional languages (clojure, cpp, erlang, fantom ...)