C Programming Code Examples C > Recursion Code Examples Program to Find G.C.D Using Recursion Program to Find G.C.D Using Recursion This program takes two positive integers as input from the user and calculates GCD using recursion. #include <stdio.h> int hcf(int j1, int j2); int main() { int j1, j2; printf("Enter two positive integers: "); scanf("%d %d", &j1, &j2); printf("G.C.D of %d and %d is %d.", j1, j2, hcf(j1,j2)); return 0; } int hcf(int j1, int j2) { if (j2 != 0) return hcf(j2, j1%j2); else return j1; }