We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Linux Shell
- Bash
- The World of Numbers
- Discussions
The World of Numbers
The World of Numbers
Sort by
recency
|
195 Discussions
|
Please Login in order to post a comment
!/bin/bash
read X read Y
echo ((X - Y))
echo ((X / Y))
read X read Y echo ((X - Y)) echo ((X / Y))
Read two integers from the user
read -p "Enter the first integer: " a read -p "Enter the second integer: " b
Perform calculations
sum=((a - b)) prod=$((a * b))
Handle division by zero
if [ "((a / b)) else quot="Undefined (division by zero)" fi
Display results
echo "diff" echo "quot"
read X read Y echo [X - Y] echo [X / Y]
read X read Y
echo X + ((Y)) echo X * ((Y))