Created
September 23, 2015 19:34
-
-
Save EduardoMil/9d07cbfa98d446f93fa7 to your computer and use it in GitHub Desktop.
um programa em C que leia 3 valores, A,B,C e os ordene 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
#include <stdio.h> | |
int a,b,c,maior=-999999999,menor=999999999,meio; | |
ordenarmaior(a,b,c){ | |
if (a>=maior){ | |
maior=a; | |
} | |
if (b>maior){ | |
maior=b; | |
} | |
if (c>maior){ | |
maior=c; | |
} | |
if (a==b==c){ | |
printf ("Seus numeros sao iguais"); | |
} | |
} | |
ordenarmenor(a,b,c){ | |
if (a<=menor){ | |
menor=a; | |
} | |
if (b<menor){ | |
menor=b; | |
} | |
if (c<menor){ | |
menor=c; | |
} | |
if (a==b==c){ | |
printf ("Seus numeros sao iguais"); | |
} | |
printf ("O menor numero digitado e: %d\n",menor); | |
} | |
ordenarmeio(a,b,c){ | |
meio=a+b+c; | |
meio=meio-(maior+menor); | |
printf("Seu numero do meio e %d \n",meio); | |
return (0); | |
} | |
int main (){ | |
printf ("Digite um numero: "); | |
scanf("%d",&a); | |
printf ("Digite um segundo numero: "); | |
scanf("%d",&b); | |
printf ("Digite um terceiro numero: "); | |
scanf("%d",&c); | |
ordenarmenor (a,b,c); | |
ordenarmaior (a,b,c); | |
ordenarmeio (a,b,c); | |
printf ("O Maior numero digitado e: %d\n",maior); | |
return (0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment