Gjort första övningen på labb 4

This commit is contained in:
2013-12-11 20:10:48 +01:00
parent e2bf2d8415
commit 1a2d33a757
2 changed files with 34 additions and 0 deletions

24
Labb4/ovning1.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Övning 1, labb 4
# Get user input
read -p "Enter first number: " Tal1
read -p "Enter second number: " Tal2
# Do the calulations
Add=$((Tal1+Tal2))
Sub=$((Tal1-Tal2))
Tim=$((Tal1*Tal2))
Div=$((Tal1/Tal2))
Mod=$((Tal1%Tal2))
# Print the calulcations and answers
echo "$Tal1 + $Tal2 = $Add"
echo "$Tal1 - $Tal2 = $Sub"
echo "$Tal1 * $Tal2 = $Tim"
echo "$Tal1 / $Tal2 = $Div, rest: $Mod"
exit 0