Algoritm pentru a afla CMMDC(cel mai mare divizor comun) si CMMMC(cel mai mic multiplu comun) al unui numar natural.
Pentru CMMDC:
Varianta 1 - impartiri repetate
C++ Code:
You have to register to be able to see this link. Register HERE!
If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
Varianta 2 - scaderi repetate , o varianta care dureaza putin mai mult din cauza a prea multor scaderi
C++ Code:
You have to register to be able to see this link. Register HERE!
If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
BONUS!- Varianta 3 - Varianta recursiva
C++ Code:
You have to register to be able to see this link. Register HERE!
If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
Personal va recomand prima varianta datorita eficientei din punct de vedere al timpului
Pentru CMMMC:
C++ Code:
You have to register to be able to see this link. Register HERE!
If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
NOTA!
-desigur ca in locul algoritmului cu scaderi repetate putem folosi algoritmul cu impartirile repetate, ramane la alegerea dumneavoastra
-va rog lasati reply daca gasiti orice fel de greseala, ma ajuta mult