Ruby Program to Find the Absolute Value of the Given Number

You are currently viewing Ruby Program to Find the Absolute Value of the Given Number

Ruby program to find the absolute value of the given number

# Ruby program to find the 
# absolute value of the given number

print "Enter number: ";
num = gets.chomp.to_i;  

result = num.abs();  

print "Absolute value: ",result;
Enter number: -234
Absolute value: 234

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply