Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Maximum of two numbers
- echo enter two numbers with spaces
- read a b
- if [ $a -eq $b ]
- then
- echo both are equal
- elif [ $a -gt $b ]
- then
- echo $a is greater
- else
- echo $b is greater
- fi
- # Maximum of three numbers
- echo enter three numbers with spaces
- read a b c
- if [ $a -eq $b -a $b -eq $c ]
- then
- echo all three are equal
- elif [ $a -gt $b -a $a -gt $c ]
- then
- echo $a is greater
- elif [ $b -gt $a -a $b -gt $c ]
- then
- echo $b is greater
- else
- echo $c is greater
- fi
Add Comment
Please, Sign In to add comment