FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 68   



Following program shows you how to take a number as input and calculate the square root of given number.
In this program we get input from user and calculate square root using Math.sqrt() method

 puts "Enter a number:"
 input = Integer(gets.chomp)
 result = Math.sqrt(input)
 puts "Squre root of #{input} is: #{result}"

Output:

Enter a number:
64
Square root of 64.0 is: 8.0



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News