Red de conocimiento informático - Descarga de software - Programación en lenguaje C: ingrese tres números x, y, z para mostrarlos en orden ascendente

Programación en lenguaje C: ingrese tres números x, y, z para mostrarlos en orden ascendente

1 Separe tres números con comas durante la entrada

#include lt; stdio.hgt

void swc(int *x, int *y){ int; t; t=*y; *y=*x; *x=t;}

principal()

{

int x, y, z

scanf("d,d,d",amp;x,amp;y,amp;z);

if(xgt;y) swc(amp;x , amplificador; y);

if (xgt; z) swc (amp; x, amp; z); z);

printf("\nd\nd\nd",x,y,z);

devuelve 0;

}

2

#include lt;stdio.hgt;

#include lt;stdlib.hgt;

#include lt;time.hgt; /p>

#define MAX 10

main()

{

unsigned int num[MAX], max, min, c, t ;

srand(time(0));

for(t=0;tlt;MAX; t) num[t]=rand()71 30;

max=min=num[0];

c=0;

for(t=0; tlt; MAX; t)

{

if(maxlt;num[t]) max=num[t];

else if(mingt;num[t]) min=num[t];

c =num[t];

printf("5d",num[t]);

}

printf("\nmax = d, min=d, promedio=d, suma=d", max, min, c/MAX, c);

devuelve 0;

}

3

#include lt;stdio.hgt;

main()

{

float s=1.0, t= 1.0 ;

int c=2, p=2;

mientras(tgt; 1e-4)

{

t= 1.0 /(flotador)c;

s =t;

c =p

p; p> printf("f", s);

devuelve 0;

}