Advertisement
sergio_educacionit

operadores arimeticos.sh

Jul 20th, 2024
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. a=10
  4. b=5
  5.  
  6. # Usando (( ))
  7. sum=$((a + b))
  8. diff=$((a - b))
  9. prod=$((a * b))
  10. quot=$((a / b))
  11. mod=$((a % b))
  12.  
  13. echo "Suma: $sum"
  14. echo "Resta: $diff"
  15. echo "Multiplicación: $prod"
  16. echo "División: $quot"
  17. echo "Módulo: $mod"
  18.  
  19. # Usando let
  20. let sum=a+b
  21. let diff=a-b
  22. let prod=a*b
  23. let quot=a/b
  24. let mod=a%b
  25.  
  26. echo "Suma: $sum"
  27. echo "Resta: $diff"
  28. echo "Multiplicación: $prod"
  29. echo "División: $quot"
  30. echo "Módulo: $mod"
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement