Table of Contents
Write a program that allows a user to enter 2 numbers in the console and the program finds the addition, subtraction, multiplication and division of the numbers.
#!/bin/bash
# read -s -p "Enter Password: " pswd
read -p "Enter Num 1: " num1
read -p "Enter Num 2: " num2
# Phép cộng
kq=$(($num1 + $num2))
echo "Kết quả phép cộng:" $kq
# Phép trừ
kq=$(($num1 - $num2))
echo "Kết quả phép trừ:" $kq
# Phép nhân
kq=$(($num1 * $num2))
echo "Kết quả phép nhân:" $kq
# Phép chia
kq=$(echo "scale=3; $num1/$num2" | bc -l )
echo "Kết quả phép chia:" $kq
# echo $(echo "2/3" | bc -l )