Wpis z mikrobloga

#cpp #naukaprogramowania
Mam pytanie, rozwiązuję zadanie z książki Praty o takiej treści:

Write a program that asks you to enter an automobile gasoline consumption figure in the European style (liters per 100 kilometers) and converts to the U.S. style of miles per gallon. Note that in addition to using different units of measurement, the U.S approach (distance / fuel) is the inverse of the European approach (fuel / distance). Note that 100 kilometers is 62.14 miles, and 1 gallon is 3.875 liters. Thus, 19 mpg is about 12.4 l/100 km, and 27 mpg is about 8.7 l/100 km.


I rozwiązując to zadanie w ten sposób. Wychodzi mi nieco inaczej. Tzn. dla spalania 12.4 l/100km, otrzymuje 19.42 mpg, gdzie w rzeczywistości powinno mi to dać 18.97 mpg. Z czego wynika moja rozbieżność?
  • 6
  • Odpowiedz
  • Otrzymuj powiadomienia
    o nowych komentarzach