read -p "Enter The Number: " n
for((i=0; i<$n; i++))doread -p "Enter value of arr[$i]: " arr[$i]done#sorting codefor((i=0; i<$n; i++))dofor((j=0; j<n-i-1; j++))doif [ ${arr[j]} -lt ${arr[$((j+1))]} ]then#swappingtemp=${arr[j]}arr[$j]=${arr[$((j+1))]}arr[$((j+1))]=$tempfidoneecho "Numbers in Descending order: " ${arr[*]}
0 Comments