Write A C Program To Find Hcf Of 4 Given Numbers Using Recursive Function
Answers
Answered by
3
cc
type pblil
bold oder
hcf =4=2
Answered by
0
Explanation:
C Program to find HCF of a given Number using Recursion:
int hcf(int, int);
int main()
{
int a, b, result;
printf("Enter the two numbers to find their HCF: "); scanf("%d%d", &a, &b);
result = hcf(a, b);
printf("The HCF of %d and %d is %d.\n", a, b, result);
}
int hcf(int a, int b)
{
while (a != b)
{
if (a > b)
{
return hcf(a - b, b);
}
else { return hcf(a, b - a);
}
}
return a;
}
#SPJ3
Similar questions
Social Sciences,
4 months ago
Accountancy,
4 months ago
English,
4 months ago
Biology,
9 months ago
Chemistry,
9 months ago
Math,
1 year ago
History,
1 year ago
Math,
1 year ago