Sep 6, 2024
if-else
statementsfor
loopArray Initialization
n
to store the number of elements in the array.Input Array Elements
n
= 7, iterate 7 times to input values.Sorting Logic
Program Implementation
for
loops to implement the sorting algorithm.Detailed Explanation
i = 0
, compare with j = i + 1
.45
with 56
.45 < 56
, no exchange is needed.45 > 12
then swap to make 12
come before 45
.Final Loop Iteration