Created
May 14, 2024 23:35
-
-
Save duranangie/1ca9564e779249fe7268a5a2f30bfcfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Algoritmo mcm | |
Definir resultado, maxExponente, i, j Como Entero | |
Dimension lista[5] | |
Dimension listaPrimo[5] | |
listaPrimo[1] <- 2 | |
listaPrimo[2] <- 3 | |
listaPrimo[3] <- 5 | |
listaPrimo[4] <- 7 | |
listaPrimo[5] <- 11 | |
Para i <- 1 Hasta 5 Hacer | |
lista[i] <- Azar(10) | |
Escribir lista[i], " " Sin Saltar; | |
FinPara | |
Escribir " "; | |
resultado <- 1 | |
Para j <- 1 Hasta 5 Hacer | |
maxExponente <- 0 | |
Para i <- 1 Hasta 5 Hacer | |
si lista[i] % listaPrimo[j] == 0 Entonces | |
mientras lista[i] % listaPrimo[j] == 0 Hacer | |
lista[i] <- lista[i] / listaPrimo[j] | |
maxExponente <- maxExponente + 1 | |
FinMientras | |
FinSi | |
FinPara | |
resultado <- resultado * listaPrimo[j]^maxExponente | |
FinPara | |
Escribir "El MCM es: ", resultado | |
FinAlgoritmo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment