Yeah its a small project but since it went up to my head I just programmed it. HCF works with Euclid's division lemma and LCM is calculated by: a*b / HCF(a,b)