-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbubble sort [ascen].fprg
39 lines (39 loc) · 1.9 KB
/
bubble sort [ascen].fprg
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
<?xml version="1.0"?>
<flowgorithm fileversion="2.11">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value="Praneeth Reddy"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2022-01-12 12:18:36 PM"/>
<attribute name="created" value="UHJhbmVldGggUmVkZHk7UFJBTkVFVEgtUEM7MjAyMi0wMS0xMjsxMTo1ODo0OCBBTTszNDE2"/>
<attribute name="edited" value="UHJhbmVldGggUmVkZHk7UFJBTkVFVEgtUEM7MjAyMi0wMS0xMjsxMjoxODozNiBQTTsxOzM1MzM="/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<declare name="size, j, i, tem" type="Integer" array="False" size=""/>
<output expression=""enter the number of integers"" newline="True"/>
<input variable="size"/>
<declare name="num" type="Integer" array="True" size="size"/>
<output expression=""enter the numbers"" newline="True"/>
<for variable="i" start="0" end="size-1" direction="inc" step="1">
<input variable="num[i]"/>
</for>
<for variable="i" start="0" end="size-1" direction="inc" step="1">
<for variable="j" start="0" end="(size-1)-i-1" direction="inc" step="1">
<if expression="num[j]>num[j+1]">
<then>
<assign variable="tem" expression="num[j]"/>
<assign variable="num[j]" expression="num[j+1]"/>
<assign variable="num[j+1]" expression="tem"/>
</then>
<else/>
</if>
</for>
</for>
<for variable="i" start="0" end="size-1" direction="inc" step="1">
<output expression="num[i]" newline="True"/>
</for>
</body>
</function>
</flowgorithm>