Ruby program to calculate parallelogram area

Views: 123   

Fallowing program shows you how to calculate parallelogram area.
This program gets parallelogram base and height from user and calculates area and prints it using following formula
Area = base X height

 puts "Please enter base of parallelogram:"
 parallelogramBase = gets.to_f
 puts "Please enter height of parallelogram: "
 parallelogramHeight = gets.to_f
 areaOfParallelogram = parallelogramBase * parallelogramHeight
 puts "Area of parallelogram is: #{areaOfParallelogram}"


Please enter base of parallelogram: 
Please enter height of parallelogram: 
Area of parallelogram is: 63.0
On By