C Online Compiler
Example: C program to find gcd using recursion
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C program to find gcd using recursion #include <stdio.h> // function to find GCD int gcd(int num1, int num2) { if (num2 != 0) { return gcd(num2, num1 % num2); } else { return num1; } } // It's main function of the program int main() { int x; int y; int gcd_num; printf("Enter the two positive integer numbers:\n"); scanf("%d %d", &x, &y); gcd_num = gcd(x, y); printf("\nG.C.D of these numbers %d and %d = %d\n", x, y, gcd_num); return 0; }
90 250
Output
Clear
ADVERTISEMENTS