46 lines
789 B
Plaintext
46 lines
789 B
Plaintext
#!/usr/bin/env bellos
|
|
# File: basic_math.bellos
|
|
|
|
# Demonstrating arithmetic operations
|
|
|
|
# Addition
|
|
result=$((5 + 3))
|
|
echo Addition: 5 + 3 = $result
|
|
|
|
# Subtraction
|
|
result=$((10 - 4))
|
|
echo Subtraction: 10 - 4 = $result
|
|
|
|
# Multiplication
|
|
result=$((6 * 7))
|
|
echo Multiplication: 6 * 7 = $result
|
|
|
|
# Division
|
|
result=$((20 / 4))
|
|
echo Division: 20 / 4 = $result
|
|
|
|
# Modulus
|
|
result=$((17 % 5))
|
|
echo Modulus: 17 % 5 = $result
|
|
|
|
# Compound operation
|
|
result=$(( (10 + 5) * 2 ))
|
|
echo Compound: (10 + 5) * 2 = $result
|
|
|
|
# Using variables
|
|
a=7
|
|
b=3
|
|
result=$((a + b))
|
|
echo Variables: $a + $b = $result
|
|
|
|
# Increment
|
|
count=0
|
|
count=$((count + 1))
|
|
echo Increment: count after increment = $count
|
|
|
|
# Decrement
|
|
count=$((count - 1))
|
|
echo Decrement: count after decrement = $count
|
|
|
|
echo Basic math operations completed.
|