Created
June 16, 2016 22:52
-
-
Save ojvribeiro/217d0bfc4edd84885d2579728705d850 to your computer and use it in GitHub Desktop.
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
Program inteiros; | |
// Declaramos todas as variaveis necessarias | |
Var int_1, int_2, int_3, maior, medio, menor : integer; | |
// Primeiro esperamos o input do usuario | |
Begin | |
writeln('Digite o primeiro número: '); | |
readln(int_1); | |
writeln('Digite o segundo número: '); | |
readln(int_2); | |
writeln('Digite o terceiro número: '); | |
readln(int_3); | |
// Verificamos qual numero é maior, medio ou menor | |
if (int_1 > int_2) and (int_1 > int_3) and (int_2 > int_3) | |
then | |
Begin | |
maior := int_1; | |
medio := int_2; | |
menor := int_3; | |
writeln('O maior numero é o ',maior); | |
writeln('Em ordem decrescente fica: ', maior,', ',medio,' e ',menor,'.'); | |
End; | |
if (int_2 > int_1) and (int_2 > int_3) and (int_1 > int_3) | |
then | |
Begin | |
maior := int_2; | |
medio := int_1; | |
menor := int_3; | |
writeln('O maior numero é o ',maior); | |
writeln('Em ordem decrescente fica: ', maior,', ',medio,' e ',menor,'.'); | |
End; | |
if (int_2 > int_1) and (int_2 > int_3) and (int_3 > int_1) | |
then | |
Begin | |
maior := int_2; | |
medio := int_3; | |
menor := int_1; | |
writeln('O maior numero é o ',maior); | |
writeln('Em ordem decrescente fica: ', maior,', ',medio,' e ',menor,'.'); | |
End; | |
if (int_3 > int_1) and (int_3 > int_2) and (int_1 > int_2) | |
then | |
Begin | |
maior := int_3; | |
medio := int_1; | |
menor := int_2; | |
writeln('O maior numero é o ',maior); | |
writeln('Em ordem decrescente fica: ', maior,', ',medio,' e ',menor,'.'); | |
End; | |
if (int_3 > int_1) and (int_3 > int_2) and (int_2 > int_1) | |
then | |
Begin | |
maior := int_3; | |
medio := int_2; | |
menor := int_1; | |
writeln('O maior numero é o ',maior); | |
writeln('Em ordem decrescente fica: ', maior,', ',medio,' e ',menor,'.'); | |
End; | |
// Vefirica se todos os numeros sao iguais | |
if (int_3 = int_1) and (int_3 = int_2) | |
then | |
Begin | |
writeln('Os três números são iguais (',int_1,').'); | |
writeln('E isso é tudo, pessoal!'); | |
End; | |
// Verifica se dois numeros sao iguais e o que sobrou é maior ou menor aos dois | |
// Se 1 = 2 e 1 > 3 | |
if (int_1 = int_2) and (int_1 > int_3) | |
then | |
Begin | |
writeln('O primeiro e o segundo número são iguais (',int_1,') e o terceiro é igual a ',int_3,', sendo que ',int_1,' é o maior.'); | |
writeln('Em ordem decrescente fica ',int_1,' e ',int_3,'.'); | |
End; | |
// Se 2 = 3 e 2 > 1 | |
if (int_2 = int_3) and (int_2 > int_1) | |
then | |
Begin | |
writeln('O segundo e o terceiro número são iguais (',int_2,') e o primeiro é igual a ',int_1,', sendo que ',int_2,' é o maior.'); | |
writeln('Em ordem decrescente fica ',int_2,' e ',int_1,'.'); | |
End; | |
// Se 1 = 2 e 1 < 3 | |
if (int_1 = int_2) and (int_1 < int_3) | |
then | |
Begin | |
writeln('O primeiro e o segundo número são iguais (',int_1,') e o terceiro é igual a ',int_3,', sendo que ',int_1,' é o menor.'); | |
writeln('Em ordem decrescente fica ',int_3,' e ',int_1,'.'); | |
End; | |
// Se 2 = 3 e 2 < 1 | |
if (int_2 = int_3) and (int_2 < int_1) | |
then | |
Begin | |
writeln('O segundo e o terceiro número são iguais (',int_2,') e o primeiro é igual a ',int_1,', sendo que ',int_2,' é o menor.'); | |
writeln('Em ordem decrescente fica ',int_1,' e ',int_2,'.'); | |
End; | |
// Se 1 = 3 e 1 > 2 | |
if (int_1 = int_3) and (int_1 > int_2) | |
then | |
Begin | |
writeln('O primeiro e o terceiro número são iguais (',int_1,') e o segundo é igual a ',int_2,', sendo que ',int_2,' é o menor.'); | |
writeln('Em ordem decrescente fica ',int_1,' e ',int_2,'.'); | |
End; | |
// Se 1 = 3 e 1 < 2 | |
if (int_1 = int_3) and (int_1 < int_2) | |
then | |
Begin | |
writeln('O primeiro e o terceiro número são iguais (',int_1,') e o segundo é igual a ',int_2,', sendo que ',int_2,' é o maior.'); | |
writeln('Em ordem decrescente fica ',int_2,' e ',int_1,'.'); | |
End; | |
// E chegamos ao fim :D | |
End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aula de Algoritmos (T1) de 16/06/2016.