Langsung mulai saja ya....
#!/bin/bash
loop=y
while [ $loop != n ]
do
clear
echo KALKULATOR:
echo 1. MENGHITUNG LINGKARANG
echo 2. MENGHITUNG VOLUME TABUNG
echo 3. MENGHITUNG LUAS SEGITIGA
echo 4. Exit
echo -n MASUKAN PILIHAN ANDA :
read a
if (($a == 1))
then
input
echo lingkaran
{
echo "========================="
echo " Hitung Luas Lingkaran"
echo "========================="
echo "Input Jari-jari lingkaran: "
read r
echo "========================="
l=`echo 3.14*$r*$r |bc`
echo "Luas lingkaran = $l"
}
elif (($a == 2 ))
then
input
echo volume_tabung
{
echo "========================="
echo " Hitung Volume tabung "
echo "========================="
echo "Input Jari-jari Tabung: "
read r
echo "Input Tinggi Tabung: "
read t
echo "========================="
k=`echo 2*3.14*$r*$r*$t |bc`
echo "Volume Tabung = $k"
}
elif (($a == 3 ))
then
input
echo "Menghitung Luas Segitiga"
echo "________________________"
echo "Masukkan alas segitiga :"
read als
echo "Masukkan Tinggi Segitiga :"
read tin
b=`echo $als*$tin*0.5|bc`
echo "Luas Segitiga adalah : $b"
else
exit
fi
echo -n "Mulai Menghitung Lagi (y,n)= "
read loop
done
screenshot program
Hasil running