FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 84   



Following program shows how to take a number as input and calculate the square of that number.
In this program we get input from user and prints square of that number using following formula
Square of number = input X input

 puts "Please enter a number:"
 input = Integer(gets.chomp)
 result = input * input
 puts "Squre of #{input} is: #{result}"

Output:

Please enter a number:
3
Squre of 3 is: 9



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News