Arithmetic/Integer: Difference between revisions
Content added Content deleted
(→{{header|ALGOL 68}}: corrected the description of the Algol 68R '/:=' operator.) |
(→{{header|Elixir}}: improvement) |
||
Line 950: | Line 950: | ||
=={{header|Elixir}}== |
=={{header|Elixir}}== |
||
⚫ | |||
<lang Elixir> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
# Get user input |
# Get user input |
||
a = |
a = get_int.("Enter your first integer: ") |
||
b = |
b = get_int.("Enter your second integer: ") |
||
IO.puts "Elixir Integer Arithmetic:\n" |
IO.puts "Elixir Integer Arithmetic:\n" |
||
IO.puts "Sum: #{a + b}" |
IO.puts "Sum: #{a + b}" |
||
IO.puts "Difference: #{a - b}" |
IO.puts "Difference: #{a - b}" |
||
IO.puts "Product: #{a * b}" |
IO.puts "Product: #{a * b}" |
||
IO.puts "True Division: #{a/b}" # Float |
IO.puts "True Division: #{a / b}" # Float |
||
IO.puts "Division: #{div(a,b)}" # Truncated Towards 0 |
IO.puts "Division: #{div(a,b)}" # Truncated Towards 0 |
||
IO.puts "Remainder: #{rem(a,b)}" # Sign from first digit |
IO.puts "Remainder: #{rem(a,b)}" # Sign from first digit |
||
IO.puts "Exponent: #{:math.pow(a,b)}" # Float, using Erlang's :math |
IO.puts "Exponent: #{:math.pow(a,b)}" # Float, using Erlang's :math</lang> |
||
</lang> |
|||
=={{header|Erlang}}== |
=={{header|Erlang}}== |