Posted on

Description

Submissions

There’re many possible solutions.

Submission 1

read X
read Y
echo $[X + Y]
echo $[X - Y]
echo $[X * Y]
echo $[X / Y]
read X read Y echo $[X + Y] echo $[X - Y] echo $[X * Y] echo $[X / Y]
read X
read Y
echo $[X + Y]
echo $[X - Y]
echo $[X * Y]
echo $[X / Y]

Submission 2

read X
read Y
echo `expr $X + $Y`
echo `expr $X - $Y`
echo `expr $X \* $Y`
echo `expr $X / $Y`
read X read Y echo `expr $X + $Y` echo `expr $X - $Y` echo `expr $X \* $Y` echo `expr $X / $Y`
read X
read Y
echo `expr $X + $Y`
echo `expr $X - $Y`
echo `expr $X \* $Y`
echo `expr $X / $Y`

References

  1. https://unix.stackexchange.com/questions/93029/how-can-i-add-subtract-etc-two-numbers-with-bash

Leave a Reply

Your email address will not be published. Required fields are marked *