Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

HCF

#include<iostream>
using namespace std;
int main()
{
  int lowest, number_1,number_2,i,hcf=1;
  cout<<"Enter Two Number for HCF👉🏻\n";
  cin>>number_1>>number_2;
if(number_1<number_2)
   { lowest=number_1;
    
     for(i=1;i<=lowest;i++)
         {  if(number_1%i==0 and number_2%i==0)
              {
                hcf=i;
              }
         }
     cout<<"🤫👉🏻 "<<hcf<<endl;
    }
if(number_1>number_2)
{ lowest=number_2;
  for(i=1;i<=number_2;i++)
     { if(number_1%i==0 and number_2%i==0)
         {
           hcf=i;
          }
      }
  cout<<"🤫👉🏻 "<<hcf<<endl;
}
if(number_1==number_2)
{
    cout<<"🤓👉🏻 "<<number_1<<endl;
}
    
    
 return 0;
}

 run  | edit  | history  | help 1