SHOW:
|
|
- or go back to the newest paste.
1 | require 'mathn' | |
2 | ||
3 | puts "random name" | |
4 | puts "random name" | |
5 | puts " " | |
6 | ||
7 | puts "The program calculates the hypotenuse." | |
8 | ||
9 | puts "Input a:" | |
10 | - | a = gets |
10 | + | a = gets.to_i |
11 | ||
12 | puts "Input b:" | |
13 | - | b = gets |
13 | + | b = gets.to_i |
14 | c = Math.sqrt(a*a+b*b) | |
15 | ||
16 | - | puts "hypotenuse c: " + c |
16 | + | puts "hypotenuse c: " + c.to_s |
17 | ||
18 | gets |