Q. How do I write shell script to find Smallest and Greatest number in an array
Ans:
#!/bin/bash
echo "enter size of an array"
read n
#taking input from user
for((i=0;i
echo " enter $((i+1)) number"
read nos[$i]
done
#printing the entered number
echo "number entered are"
for((i=0;i
echo ${nos[$i]}
done
#main loop
small=${nos[0]}
greatest=${nos[0]}
for((i=0;i
#
0 comments:
Post a Comment