Created
April 20, 2012 16:38
-
-
Save christonog/2430185 to your computer and use it in GitHub Desktop.
mortgage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "I want to pay x amount per month. How much house can I afford?" | |
each_payment = gets.chomp.to_i | |
interest_rate = 0.045 | |
interest_rate_per_period = interest_rate/12 | |
number_of_payments = 360 | |
loan_amount = (each_payment/interest_rate_per_period)*(1-(1+interest_rate_per_period)**-number_of_payments) | |
puts loan_amount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment