Tux Education Our New Education Channel Please Share And Subscribe It...

/* HCF (Highest Common Factor) Program With Two Numbers */


// Compiler : Dev C++4.9.9.2

#include<stdio.h>

int main()
{
    int a,b;
    printf("A : ");
    scanf("%d",&a);
    
    printf("\n\nB : ");
    scanf("%d",&b);
    
    while(a!=b)
    if(a>=b-1)
    a-=b;
    else
    b-=a;
    
    printf("\n\nH C F : %d",a);
    
    getch();    
    return 0;
}

Post a Comment