Created
May 22, 2013 19:12
-
-
Save ahoulgrave/5630104 to your computer and use it in GitHub Desktop.
Algoritmo para saber si un número es perfecto
This file contains hidden or 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 numeroPerfecto | |
var | |
int: | |
i, num, res, sumaDivisores | |
Inicio | |
i = 1 | |
res = 0 | |
sumaDivisores = 0 | |
LEER num | |
MIENTRAS i <= num-1 ENTONCES | |
res = num MOD i | |
SI res == 0 ENTONCES | |
sumaDivisores = sumaDivisores+i | |
FIN_SI | |
i = i+1 | |
FIN_MIENTRAS | |
SI sumaDivisores == num ENTONCES | |
ESCRIBIR "El número es perfecto" | |
SINO | |
ESCRIBIR "El número no es perfecto" | |
FIN_SI | |
Fin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment