Rushal Arora

Rushal Arora

  • NA
  • 112
  • 175.4k

Conversion from C++ to C#

Dec 11 2013 1:30 PM

#include "iostream"

using namespace std;

int main()
{
    int num1,num2,hcf=0,cont=0,lcm;

    do{
    cout<<"Enter 2 number to find H.C.F OR G.C.D"<<endl;
    cin>>num1>>num2;
    for(int i=1;i<=num1 && i<=num2;i++)
    {
        if((num1%i == 0)&&(num2%i==0))
        {
            hcf=i;
        }
    }
    cout<<"HCF ="<<hcf<<endl;
   
    lcm=(num1*num2)/hcf;

    cout<<"L.C.M = "<<lcm<<endl;

    cout<<"want to continue"<<endl;
    cin>>cont;
    }while(cont>0);

    return 0;
}



Answers (2)