# LCM of two numbers

### From CodeCodex

#include<iostream.h> #include<conio.h> class lcm { int c; public: calc(int,int); }; lcm::calc(int x,int y) { int d=1; while(d<=x && d<=y) { if (x%d==0 && y%d==0) { c=d; d++; } else d++; } if(x%c==0 && y%c==0 && c!=1) cout<<"The lcm is "<<y*(x/c)<<endl; else cout<<"The numbers are prime"<<endl; } void main() { int a,b; lcm ob; cout<<"Enter two numbers "; cin>>a>>b; ob.calc(a,b); getch(); }