forked from ajay-prabhakar/hacktnow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
18.c
36 lines (25 loc) · 755 Bytes
/
18.c
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
36
#include <stdio.h>
void main()
{
int i, j, b, n, num[30];
printf("Enter the value of N \n");
scanf("%d", &n);
printf("Give u r values \n");
for (i = 0; i < n; ++i)
scanf("%d", &num[i]);
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (num[i] > num[j])
{
b = num[i];
num[i] = num[j];
num[j] = b;
}
}
}
printf("The numbers arranged in ascending order are given below \n");
for (i = 0; i < n; ++i)
printf("%d\n", num[i]);
}