#include <stdio.h>
#include <stdlib.h>
#include <time.h>
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
◆ main()
| int main |
( |
int | argc, |
|
|
char * | argv[] ) |
Definition at line 7 of file Ejemplo013.c.
8{
9 int i, j, n;
11 srand(time(NULL));
12 do{
13 printf("Ingrese el numero de elementos: ");
14 scanf("%d", &n);
16 printf("Ingrese el valor maximo: ");
18 printf("Ingrese el valor minimo: ");
21 {
23 {
25 {
29 }
30 else
31 {
34 }
35 }
36 else
37 {
40 }
41 }
42 printf("Desordenado.\n");
43 for(i=0; i<n; i++)
44 {
46 printf("X[%d] = %f\n", i+1, x[i]);
47 }
48
49 for(i=0; i<n-1; i++)
50 for(j=i+1; j<n; j++)
51 if(x[i]>x[j])
52 {
53 aux = x[i];
54 x[i] = x[j];
55 x[j] = aux;
56 }
57 printf("Ordenado.\n");
58 for(i=0; i<n; i++)
59 printf("X[%d] = %f\n", i+1, x[i]);
60 return 0;
61}