Computer Science, asked by anitawadhwanip5dx74, 11 months ago

program to print hcf of a number using recursion method​

Answers

Answered by BAAZ7466
11

Answer:

hey dear.... ur answer is.... ~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/*

* C Program to find HCF of a given Number using Recursion

*/

#include <stdio.h>

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;

}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

mark as brainliest, ❤

follow me❤

Answered by marefath123
2

Answer:

the arbaaz is very good in answering the questions so u can take help from arbaaz

he was like amazing in answering .So i suggest her brinly topper here

hope u all understand friends

And hi arbaaz

Similar questions