-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathascending2.c
executable file
·69 lines (42 loc) · 1.08 KB
/
ascending2.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Marcus Kapoor
// Fun Fact: Team Yasuo is going down.
#include <stdio.h>
int main () {
int A[3];
int B[3];
printf("Array A:\n");
for (int x = 0; x < 3; x++)
{
printf("What is number %d? ", x+1);
scanf("%d", &A[x]);
}
printf("\n");
printf("Array B:\n");
for (int y = 0; y < 3; y++)
{
printf("What is number %d? ", y+1);
scanf("%d", &B[y]);
}
printf("\n");
// =============================================
int C[6] = {A[0], A[1], A[2], B[0], B[1], B[2]};
for (int i = 0; i < 30; i++)
{
for (int j = 1; j < 6; j++)
{
if (C[j] < C[j-1])
{
int temp = C[j];
C[j] = C[j-1];
C[j-1] = temp;
}
}
}
printf("Array C: ");
for (int n = 0; n < 6; n++)
{
printf("%d ", C[n]);
}
printf("\n");
return 0;
}