-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
  • 15,400
  • 1
  • 8
  • 16
0

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

Custom numeric format strings

Qwertyluk
  • 156
  • 2
  • 12