# Write a C program to find the GCD of two given integers by using the recursive function

In this article, we will write a C program to find the GCD of two given integers by using the recursive function.

# Algorithm:

### Main program:

Step 1: start

Step 3: call the sub program GCD(a,b) for print the value

Step 4: stop

### Sub program: GCD(n,m)

Step 1: if n>m return GCD(n,m)

Step 2: if n==0 return m else goto step 3

Step 3: return GCD (n,m%n)

# Write a C program to find the GCD of two given integers by  using the recursive function

``````#include <stdio.h>
#include <conio.h>

int gcdrecursive(int m, int n)
{
if (n > m)
return gcdrecursive(n, m);
if (n == 0)
return m;
else
}
void main()
{
int a, b, igcd;
clrscr();
printf("enter the two numbers whose gcd is to be found:");
scanf("%d%d", &a, &b);
printf("GCD of a,b is %d", gcdrecursive(a, b));	// return to the sub program getch();
}
``````

Input:

``````Enter the two numbers whose gcd is to be found: 5 25
``````

Output:

``GCD of a,b is : 5 ``