Zebra0

Learn to Program Step-by-Step

Gas Price Pseudocode

Algorithm

  1. Input the cost per liter in Euros: cost
  2. Input the conversion rate for Euros to dollars: exchange
  3. priceGallons=cost*3.78
  4. priceDollars=[priceGallon*exchage
  5. Output priceDollars

Pseudocode:

  1. declare the variables: cost, exchange, priceGallons, priceDollars
  2. prompt for cost
  3. input cost
  4. prompt exchange
  5. input exchange
  6. priceGallons=cost*3.78 (print out)
  7. priceDollars=[priceGallon*exchage
  8. Output priceDollars
Like us on Facebook:


OER: Open Educational Resource
Creative Commons License Author: Janet E. Joy; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: April 15 2016 15:56:37.