Skip to content

Instantly share code, notes, and snippets.

@serinuntius
Created May 22, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serinuntius/9a25ee08075c4107c84a7adc2e6b8b16 to your computer and use it in GitHub Desktop.
Save serinuntius/9a25ee08075c4107c84a7adc2e6b8b16 to your computer and use it in GitHub Desktop.
複利シミュレーション まめた用
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