Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # This is implemented in C.run--I named it as python because the syntax highlighting is close.
  2. real pounds_per_kilo = 2.2
  3. int ounces_per_pound = 16
  4.  
  5. # Get the number of kilos from the user:
  6. real kilos = prompt "How many kilos?"
  7.  
  8. # Convert that number into ounces:
  9. real total_ounces = kilos * pounds_per_kilo * ounces_per_pound
  10.  
  11. # Find out how many complete pounds you can get from those ounces:
  12. int pounds = total_ounces / 16
  13.  
  14. # Find out how many ounces are left over:
  15. real ounces = total_ounces % 16
  16.  
  17. # Print the results:
  18. print pounds + " lbs, "+ ounces +" oz."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement