#include <iosteram>
using namespace std;
int main()
{
    int gcd,lcm n1,n2 i;
    cout<<"enter the value n1:";
    cin>>n1;
    cout<<"enter the value n2:";
    cin>>n2
    for(i=1;i<100;i++)
    {
        if((n1%i==0)&&(n2%i==0))
        {
            gcd=i;
        }
    }
cout<<"gcd of two numbers is:"<<gcd<<endl;
lcm=n1*n2/gcd;
cout<<"lcm of two numbers is:"<<lcm<<endl;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: