Find HCF of Two Numbers using Recursion

#include <stdio.h>
int hcf (int, int);


int h, i, a, b;
printf(" Enter values of two numbers: ");
scanf("%d %d", &a, &b);

h = hcf(a, b);

printf(" HCF of numbers is: %d", h);



int hcf(int a, int b)

if (a%b == 0)
return b;
return hcf(b, a%b);


Upload Content

Upload your original content. We will publish your material under your name on W3Professors after review.


Without your feedback, such words as Improvement, Achievement and Success have no meaning for us.

W3Professors is only to provide online education. We do not warrant oraginality of any content. Whole content is uploaded by someone so if you feel that particular content is copied or not upto mark. You can click on Copied Content link. We will remove that content Immediately. You agree to have read and accept our Terms of Use and Privacy Policy. © Copyright 2008-2015 W3Professors.Com All Rights Reserved.

Designed and Maintained by Kanwer Technologies