Tuesday, 23 June 2015

C PROGRAM TO FIND HCF OF TWO NUMBERS



#include<stdio.h>
int main()
{
    int a,b;
    printf("Enter two integer values : ");
    scanf("%d %d",&a,&b);
    printf("HCF of %d and %d is ",a , b);
    while(a!=b)
    {
        if(a>b)
            a -= b;
        else
            b -= a;
    }
    printf("%d",a);
    return 0;
}


OUTPUT
Enter two integer values : 23
48
HCF of 23 and 48 is 1