-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractica8a.c
More file actions
35 lines (27 loc) · 714 Bytes
/
practica8a.c
File metadata and controls
35 lines (27 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
//CT
int main()
{
int ordenar;
int num[10];
printf("===============================================\n\n");
printf("¡Hola! Este programa ordena números ascendentemente\n\n");
printf("Ingresa 10 números a ordenar:\n");
for (int i = 0; i <= 10 ; i++){
scanf("%d",&num[i]);
}
for (int i = 0 ; i <= 10; i++){
for (int j = 0 ; j <= 10 - i - 1; j++){
if (num[j] > num[j+1]){
ordenar = num[j];
num[j] = num[j+1];
num[j+1] = ordenar;
}
}
}
printf("Los números en orden ascendente son:\n\n");
for (int i = 0; i <= 10; i++)
printf("%d\n", num[i]);
printf("\n===============================================\n\n");
return 0;
}