Why this is Happening??
Can you explain this : int main() { int a,b,c; cout<< "Enter two nos :"<<endl; cout<< "Enter first no. : "; cin>>a; // Entered 18 cout<< "Enter sec. no. : "; cin>>b; //Entered 13 c=a*b; //c=18*13 == 234 while(a!=b) //(18!=13) ==True { if(a>b) //(18>13) == True a=a-b; // a = 18-13 == 5 else //Skipped since (a>b) b=b-a; //Skipped } cout<< "HCF = " << a<<endl; //HCF = 5 cout<< "LCM = " << c/a<<endl; // LCM = 234/5 == 46 return 0; } But the output is HCF = 1 LCM = 234 WHY??