-1

This is what I'm trying to do:-

    double x = 4.0
    double y = 4.0
    x+y = 8.0

The input has to be of double type only (given condition of the problem).

PixieDev
  • 307
  • 7
  • 19

1 Answers1

2
printf("%.1lf", yournumber);

will do the trick. This will print value to 1 decimal place. In case number is 1.123, printed number will be rounded, in this case to 1.1.

unalignedmemoryaccess
  • 7,246
  • 2
  • 25
  • 40