fork download
  1. x=8
  2. y=2
  3.  
  4.  
  5. addition=$((x + y))
  6. echo "1. Addition: $addition"
  7.  
  8.  
  9. subtraction=$((x - y))
  10. echo "2. Subtraction: $subtraction"
  11.  
  12.  
  13. multiplication=$((x * y))
  14. echo "3. Multiplication: $multiplication"
  15.  
  16.  
  17. division=$(echo "scale=2; $x / $y" | bc)
  18. echo "4. Division: $division"
  19.  
  20.  
  21. exponentiation=$((x**y))
  22. echo "5. Exponentiation: $exponentiation"
  23.  
  24.  
  25. modular_division=$((x % y))
  26. echo "6. Modular Division: $modular_division"
  27.  
  28.  
  29. x=$((x + 5))
  30. echo "7. Incrementing x by 5: $x"
  31.  
  32.  
  33. x=$((x - 5))
  34. echo "8. Decrementing x by 5: $x"
  35.  
  36.  
  37. x=$((x * 5))
  38. echo "9. Multiply x by 5: $x"
  39.  
  40.  
  41. division_x=$(echo "scale=2; $x / 5" | bc)
  42. echo "10. Dividing x by 5: $division_x"
  43.  
  44.  
  45. remainder=$((x % 5))
  46. echo "11. Remainder of dividing x by 5: $remainder"
  47.  
Success #stdin #stdout 0.01s 5292KB
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