-3
double d = 4.0;
double e = 4.0;

Console.WriteLine(d + e);

output is 8 but need to get output as 8.0

2 Answers2

0

You want to specify the formatting of the value.

For example

 Console.WriteLine((d + e).ToString("N1"));
JonasH
  • 28,608
  • 2
  • 10
  • 23
0

Console.WriteLine(String.Format("{0:0.0}", d + e));

Custom numeric format strings

Qwertyluk
  • 363
  • 3
  • 14