Write an interactive program using recursion for the following:
(a) To find the HCF of two given numbers.
(b) To find the GCD of two given numbers.
(c) To find the factorial of a given number.
(a) To find the HCF of two given numbers:
#include <stdio.h>
int hcf(int a, int b) {
if (b == 0) {
return a;
}
return hcf(b, a % b);
}
int main() {
int a, b;
printf("Enter two numbers: ");
scanf("%d%d", &a, &b);
____ _______ ________ ______ _____ __________ _________ _______ ____ ____ ______.
___ ______ ________ ______ ________ ________.
____ _____ _________ _______ _________ ________ ______ ____ _____ _________ ____.
__________ __________ __________ ______ _______.
____ _______ ______ _________ __________.
___ ____ _____ _____ _________ _____ _________.
________ __________ _____ ____ ___ _______ _____.
___ ________ ___ __________ ____.
______ _____ _____ ______ _____.
________ ____ ___ ___ _______ _____ _______ _____ ______ ___.
______ ____ ___ ______ _________.
_______ ____ __________ ____ ____.
_________ __________ ________ ___ _____ ____ ___ __________ _____ ________ ________ _________.
___ ______ ___ ___ _________ ____ ______ __________ _____ _________.
____ ___ _______ ______ ________ _________.
_____ ____ __________ _______ __________ _______ ________ ___ ___ ___ _________.
_____ ___ ______ _______ ______ __________ ________ ___ _____ _____ ________.
___ _______ ________ ______ __________ __________ ________ ________ ____.
____ _______ _____ _________ ___.
______ ___ ______ _______ ___ __________ __________.
____ ____ _________ __________ _____ ___ ______ ________ _______.
_____ __________ ___ ____ ________ _________ ______.
______ _______ _______ _____ _____ _____ _____ __________ _______ ____ __________.
_____ ____ ____ _______ ____ _____ _______ _____ _____.
____ ___ __________ _________ _____ ____ __________.
Get Full Answer on WhatsApp