Created
May 22, 2019 11:36
-
-
Save serinuntius/9a25ee08075c4107c84a7adc2e6b8b16 to your computer and use it in GitHub Desktop.
複利シミュレーション まめた用
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
print("貯金する額は?\n") | |
chokin = gets.to_i | |
print("年利は何%?\n") | |
nenri = gets.to_i / 100.0 | |
print("何年貯金する?\n") | |
year = gets.to_i | |
sum = chokin | |
year.times do | |
sum += (sum * nenri).to_i | |
end | |
print("#{year}年で#{sum}円に増えました!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment