0

I'm trying to write a program that finds the salvage value of an item after entering the purchase price, annual depreciation, and years of service.

Annual Depreciation= (Purchase Price-Salvage Value)/Years of Service Here is my code:

When inputting 5000, 8, 5.25 I should return 4958.00000

verdammelt
  • 922
  • 10
  • 22
Brett
  • 183
  • 3
  • 9
  • 1
    Related: [Why does scanf() need “%lf” for doubles, when printf() is okay with just “%f”](http://stackoverflow.com/questions/210590/why-does-scanf-need-lf-for-doubles-when-printf-is-okay-with-just-f) – Mark Plotnick May 22 '16 at 03:23
  • You should check the return value from `scanf()` each time you use it. For debugging purposes, you should print the value you just read so that you know that the program got the value you expected it to get. – Jonathan Leffler May 22 '16 at 03:51

0 Answers0