G.C.D By Recursion

#include<stdio.h>
int anik(int a, int b)
{
    if(b == 0)
    {
        return a;
    }
    else
    {
        return anik(b, a%b);
    }
}
int main()
{
    int x, y, rob, temp;

    printf("Enter Two Number : ");
    scanf("%d %d", &x, &y);

    if(x<y)
    {
        temp = x;
        x = y;
        y = temp;
    }

    rob = anik(x, y);

    printf("G.C.D is : %d\n", rob);

    return 0;
}

Comments