हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा ११

Write a program to find the LCM and GCD of two numbers. - Computer Science

Advertisements
Advertisements

प्रश्न

Write a program to find the LCM and GCD of two numbers.

टिप्पणी लिखिए

उत्तर

#include<iostream>
using namespace std;
int main ()
{
int a1, b1 lcm, gcd = 1, p;
cout<<"\n Enter 1st no:";
cin>>a1;
cout<<"\n Enter 2nd no:";
cin>>b1;
p = a1*b1;
for(int i = a1; j<=p; i++)
if(i%a1==0) && (i%b1==0)
{
1cm = i;
break;
}
cout<<"L.C.M.="<<1cm<<endl;
gcd = p/LCM;
cout<<"G.C.D="<<gcd;
cin.get();
return ();
}

shaalaa.com
Statements
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 10: Flow of Control - Evaluation - Section - D [पृष्ठ १७९]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 11 TN Board
अध्याय 10 Flow of Control
Evaluation - Section - D | Q 3. | पृष्ठ १७९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×