C program to find out H.C.F. of two numbers.

source code


#include<stdio.h>
int main()
{
    int x,y,m,i;
    printf("Insert any two number: ");
    scanf("%d%d",&x,&y);
    if(x>y)
         m=y;
    else
         m=x;
  for(i=m;i>=1;i--)
{
         if(x%i==0&&y%i==0){
             printf("\nHCF of two number is : %d",i) ;
             break;
         }
}
    return 0;
    getch();
}

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.