Finding the HCF by Using a Method
Learn to find the HCF of two numbers using methods in Ruby.
Problem
Write a program that asks the user to enter two non-negative integers and then finds the highest common factor (HCF). The program must define a method that returns the divisors of a number.
Access this course and 1400+ top-rated courses and projects.