LCM ni toping
C++
xxxxxxxxxx
using namespace std;
int main()
{
int n1, n2, max;
cout << "Enter two numbers: ";
cin >> n1 >> n2;
max = (n1 > n2) ? n1 : n2;
do
{
if (max % n1 == 0 && max % n2 == 0)
{
cout << "LCM = " << max;
break;
}
else
++max;
} while (true);
return 0;
}
Enter two numbers: 12 18 LCM = 36
HCF yordamida LCM ni toping
LCM = (n1 * n2) / HCF
C++
xxxxxxxxxx
using namespace std;
int main()
{
int n1, n2, hcf, temp, lcm;
cout << "Enter two numbers: ";
cin >> n1 >> n2;
hcf = n1;
temp = n2;
while(hcf != temp)
{
if(hcf > temp)
hcf -= temp;
else
temp -= hcf;
}
lcm = (n1 * n2) / hcf;
cout << "LCM = " << lcm;
return 0;
}
Linux - anc-api-tools qanday o'rnatiladi
Linux - curvedns qanday o'rnatiladi
Python - Raqamning ijobiy, salbiy yoki 0 ekanligini tekshiring
Linux - zenmap qanday o'rnatiladi
C++ - Raqam tub yoki oddiy emasligini tekshiring
C - Butun sondagi raqamlar sonini sanash
C++ - Kabisa yilini tekshiring
Kotlin - Raqamni n o‘nlik kasrgacha yaxlitlash
JavaScript - Satr ma'lum belgilar bilan boshlanishi va tugashini tekshiring
C - Dinamik xotira ajratish yordamida eng katta raqamni toping
Kotlin - Raqamni teskari aylantirish
Java - Raqamni teskari aylantirish
Linux - zstd qanday o'rnatiladi
Kotlin - Sonning faktorialini toping
Linux - xbitmaps qanday o'rnatiladi
C++ - Ikkilik sonni oʻnlik songa va aksincha oʻzgartiring
Linux - zfs-test qanday o'rnatiladi
Kotlin - Natural sonlar yig‘indisini hisoblang
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month