fork(1) download
  1. using System;
  2.  
  3. namespace Articulo.Pregunta.P1720
  4. {
  5. public class FormatoDecimal
  6. {
  7. public static void Main()
  8. {
  9. Console.WriteLine ();
  10.  
  11. // DefiniciĆ³n variable decimal:
  12. decimal valor = 951753456.951753456M;
  13. Console.WriteLine (valor);
  14.  
  15. Console.WriteLine ();
  16.  
  17. Console.WriteLine (valor.ToString("#.##"));
  18. Console.WriteLine (String.Format("{0:0.00}", valor));
  19. Console.WriteLine (valor.ToString("N2"));
  20. Console.WriteLine ("{0:C}", valor);
  21.  
  22. Console.WriteLine ();
  23. }
  24. }
  25. }
Success #stdin #stdout 0.05s 23992KB
stdin
Standard input is empty
stdout
951753456.951753456

951753456.95
951753456.95
951,753,456.95
$951,753,456.95