Started övning 4, labb 6
This commit is contained in:
34
Labb6/ovning4/calc.sh
Normal file
34
Labb6/ovning4/calc.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Jack-Benny Persson
|
||||
# LX13
|
||||
# Övning 4, labb 6
|
||||
# Make a calculator that could do add, substract, divide and times
|
||||
|
||||
# Define our variables
|
||||
Nr1=$1
|
||||
Nr2=$2
|
||||
|
||||
# Define our functions
|
||||
add()
|
||||
{
|
||||
Sum=$((Nr1+Nr2))
|
||||
}
|
||||
|
||||
sub()
|
||||
{
|
||||
Sum=$((Nr1-Nr2))
|
||||
}
|
||||
|
||||
div()
|
||||
{
|
||||
Sum=$((Nr1/Nr2))
|
||||
}
|
||||
|
||||
tim()
|
||||
{
|
||||
Sum=$((Nr*Nr2))
|
||||
}
|
||||
|
||||
|
||||
# Main
|
Reference in New Issue
Block a user