FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 63   



Following program shows you how to calculate interest.
In this program we get investment, interest rate and time from user and calculate interest using following formula
Interest = investment X interestRate X time / 100

 puts "Enter investment:"
 investment = Integer(gets.chomp)
 puts "Enter interest rate:"
 interestRate = Integer(gets.chomp)
 puts "Enter number of years:"
 time = Integer(gets.chomp)
 interest = investment * interestRate * time / 100
 puts "Interest amount is: #{interest}"

Output:

Enter investment:
100000
Enter interest rate:
24
Enter number of years:
2
Interest amount is: 48000



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News