Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Bash by filip ( 2 years ago )
// cifri
echo -n "Enter a number: "
read input
case $input in
[0-9])
echo "You entered a one-digit number"
;;
[0-9][0-9])
echo "You entered a two-digit number"
;;
[0-9][0-9][0-9])
echo "You entered a three-digit number"
;;
*)
echo "You entered a number with more than three digits"
;;
esac
// 1 2 3 4 5
echo "Please enter a number of rows for the sequence to stop at:"
read rows
echo "Here is the pattern:"
for ((i=1; i<=$rows; i++)); do
for ((j=1; j<=$rows; j++)); do
if [ "$j" -le "$i" ]; then
echo -n "$i "
else
echo -n "$j "
fi
done
echo " "
done
//smallest and avg
echo "Enter the first number:"
read num1
echo "Enter the second number:"
read num2
echo "Enter the third number:"
read num3
smallest=$num1
if [ "$num2" -lt "$smallest" ]; then
smallest=$num2
fi
if [ "$num3" -lt "$smallest" ]; then
smallest=$num3
fi
echo "The smallest number is: $smallest"
average=$(echo "scale=2; ($num1 + $num2 + $num3) / 3" | bc)
echo "Their average is: $average"
Revise this Paste
Children: 127100