Find HCF and LCM in ruby