#!/bin/sh read -p "enter the no. of element" n for((i=0; i < n; i++)) { read -p "enter elements" a[i] } k=0 while((k<n)) { i=$k for((j=$i+1;j<n;j++)) { if(($a[i]>$a[j])) then i=$j fi } temp=$a[k] a[k]=$a[i] a[i]=$temp ((k++)) } for((l=0;l<n;l++)) do echo $a[l] done exit 0
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more