Write a C program to find GCD of two numbers using recursive function.

 Write a C program to find GCD of two numbers using recursive

function.

#include <stdio.h>
int hcf(int n1, int n2);
void main()
{
int n1, n2;
printf("Enter two integers\n");
scanf("%d%d", &n1, &n2);
printf("GCD is %d", hcf(n1, n2));
}
int hcf(int n1, int n2)
{
if (n2 != 0)
return hcf(n2, n1%n2);
else
return n1;
}

Comments