We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c0852a commit 01d8de3Copy full SHA for 01d8de3
examples/selection_sort.pc
@@ -0,0 +1,47 @@
1
+n = 0
2
+
3
+OUTPUT "Enter the number of elements:"
4
+INPUT n
5
6
+INT x[n]
7
8
+i = 0
9
10
+OUTPUT "Now enter each element one by one"
11
12
+WHILE i < n DO
13
+ INPUT x[i]
14
+ i = i + 1
15
+ENDWHILE
16
17
18
+j = 0
19
+min = 0
20
21
22
+ j = i
23
+ min = j
24
+ WHILE j < n DO
25
+ IF x[j] < x[min] THEN
26
27
+ ENDIF
28
+ j = j + 1
29
+ ENDWHILE
30
31
+ temp = x[i]
32
+ temp2 = x[min]
33
34
+ x[min] = temp
35
+ x[i] = temp2
36
37
38
39
40
+OUTPUT "Here is the sorted Array:"
41
42
43
44
45
+ OUTPUT x[i]
46
47
0 commit comments