/* Declaramos Librerias */
#include
#include
main() /* Iniciamos */
{
int x1,x2,x3; /* Declaramos enteros */
clrscr(); /* Limpiamos pantalla */
printf("Imprimir Ordenados los numeros"); /* Imprimimos */
printf("\n\n Dame el numero 1, 2 y 3:\n");
scanf("%d %d %d",&x1,&x2,&x3); /*Escaneamos y guardamos valores enteros */
printf("\n\n");
if ((x1>x2) && (x1>x3)) /* Si x1 es mayor que x2 y x3, y x2 es mayor que x3 */
if (x2>x3)
printf("%d %d %d",x1,x2,x3);
else
printf("%d %d %d",x1,x3,x2);
if ((x2>x1) && (x2>x3))
if (x1>x3)
printf("%d %d %d",x2,x1,x3);
else
printf("%d %d %d",x2,x3,x1);
if ((x3>x1) && (x3>x2))
if (x1>x2)
printf("%d %d %d",x3,x1,x2);
else
printf("%d %d %d",x3,x2,x1);
getch();
return 0;
}
A Greek town with natural aquifers on the sea shore Therma Ikaria
-
On the Greek island of Ikaria there isn't just quietness, life span (it is
one of the longest-lived spots on earth), communities, and shrouded sea
shores t...
Hace 4 años
2 comentarios:
Con la mitad de if_else y con una sola condicion cada uno ;)(Compilado en dev C++ y funcionando perfectamente
#include
main (){
int a,b,c,aux;
printf ("Introduce 3 numeros:\n");
scanf ("%i,%i,%i",&a,&b,&c);
if (a>b){}
else {
aux=a;
a=b;
b=aux;
}
if (a>c){}
else {
aux=a;
a=c;
c=b;
b=aux;
}
if (b>c){}
else{
aux=b;
b=c;
c=aux;
}
printf ("%i, %i y %i.\n",a,b,c);
system ("pause");
return (0);
}
en c# com seria
Publicar un comentario