Created
February 24, 2017 20:26
-
-
Save FelipeGrijo/9bfe7770218281d31fb321e06ef73f37 to your computer and use it in GitHub Desktop.
09) Construa um algoritmo que leia três valores inteiros e os imprima em ordem crescente
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
//https://gist.github.com/FelipeGrijo | |
#include <stdio.h> | |
int main() | |
{ | |
int Num1,Num2,Num3,x=0; | |
printf("Exercicio 9\nDigite 3 numeros.\nPrimeiro numero:"); | |
scanf("%d",&Num1); | |
printf("Segundo numero:"); | |
scanf("%d",&Num2); | |
printf("Terceiro numero:"); | |
scanf("%d",&Num3); | |
if(Num1 > Num2){ | |
x=Num1; | |
Num1=Num2; | |
Num2=x; | |
} | |
if(Num2 <= Num3){ | |
printf("A ordem crescente e: %d %d %d\n",Num1,Num2,Num3); | |
} | |
else | |
{ | |
if(Num1 <= Num3){ | |
printf("A ordem crescente e: %d %d %d\n",Num1,Num3,Num2); | |
} | |
else | |
{ | |
printf("A ordem crescente e: %d %d %d\n",Num3,Num1,Num2); | |
} | |
} | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment