fork download
  1. x=8
  2. y=2
  3.  
  4.  
  5. addition=$((x + y))
  6. echo "1. Addition: $addition"
  7.  
  8. subtraction=$((x - y))
  9. echo "2. Subtraction: $subtraction"
  10.  
  11. multiplication=$((x * y))
  12. echo "3. Multiplication: $multiplication"
  13.  
  14. division=$(echo "scale=2; $x / $y" | bc)
  15. echo "4. Division: $division"
  16.  
  17. exponentiation=$((x**y))
  18. echo "5. Exponentiation: $exponentiation"
  19.  
  20. modular_division=$((x % y))
  21. echo "6. Modular Division: $modular_division"
  22.  
  23. x=$((x + 5))
  24. echo "7. Incrementing x by 5: $x"
  25.  
  26. x=$((x - 5))
  27. echo "8. Decrementing x by 5: $x"
  28.  
  29. x=$((x * 5))
  30. echo "9. Multiply x by 5: $x"
  31.  
  32. division_x=$(echo "scale=2; $x / 5" | bc)
  33. echo "10. Dividing x by 5: $division_x"
  34.  
  35. remainder=$((x % 5))
  36. echo "11. Remainder of dividing x by 5: $remainder"
  37.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
1. Addition: 10
2. Subtraction: 6
3. Multiplication: 16
4. Division: 4.00
5. Exponentiation: 64
6. Modular Division: 0
7. Incrementing x by 5: 13
8. Decrementing x by 5: 8
9. Multiply x by 5: 40
10. Dividing x by 5: 8.00
11. Remainder of dividing x by 5: 0