Ruby Program to Perform Integer Division of Two Numbers Using DIV() Function

You are currently viewing Ruby Program to Perform Integer Division of Two Numbers Using DIV() Function

Ruby program to perform integer division of two numbers using div() function

# Ruby program to find the LCM 
# using library function

print "Enter number1: ";
num1 = gets.chomp.to_i;  

print "Enter number2: ";
num2 = gets.chomp.to_i;  

result = num1.lcm(num2);

print "Lowest Common Multiple: ",result;
Enter number1: 21
Enter number1: 3
Division is: 7

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