Header Ads

Shell Scripting : Mini Calculator with Add, Sub, Mul, & Div Operations - 09

This is a Mini Calculator to perform operations such as Addition, Subtraction, Multiplication, and Division, operation's. 

Program Code:

#!/bin/bash

echo "Enter A : "
read a
echo "Enter B : "
read b

add=$(($a+$b))
sub=$(($a-$b))
mul=$(($a*$b))
div=$(($a/$b))
mod=$(($a%$b))

echo "Add = $add"
echo "Sub = $sub"
echo "Mul = $mul"
echo "Div = $div"
echo "Mod = $mod"

Program Output:

No comments