C Program to find HCF (Highest common factor) program with two numbers




c programming
c programming
/**********************************************************************
HCF (Highest common factor)  program with two numbers in c
 **********************************************************************/
#include<stdio.h>
int main(){
  int number_1,number_2;
  printf("\nEnter two numbers:");
  scanf("%d %d",&number_1,&number_2);
  while(number_1!=number_2){
      if(number_1>=number_2-1)
        number_1=number_1-number_2;
      else
        number_2=number_2-number_1;
    }
  printf("\nGCD=%d",number_1);
  return 0;
}


/*

OUTPUT:


Enter two numbers:3
12

GCD=3 


*/

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*