How to resolve the algorithm Arithmetic/Integer step by step in the ERRE programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Arithmetic/Integer step by step in the ERRE programming language
Table of Contents
Problem Statement
Get two integers from the user, and then (for those two integers), display their:
Don't include error handling. For quotient, indicate how it rounds (e.g. towards zero, towards negative infinity, etc.). For remainder, indicate whether its sign matches the sign of the first operand or of the second operand, if they are different.
Bonus: Include an example of the integer divmod
operator. For example: as in #Haskell, #Python and #ALGOL 68
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Arithmetic/Integer step by step in the ERRE programming language
Source code in the erre programming language
PROGRAM INTEGER_ARITHMETIC
!
! for rosettacode.org
!
!$INTEGER
BEGIN
INPUT("Enter a number ",A)
INPUT("Enter another number ",B)
PRINT("Addition ";A;"+";B;"=";(A+B))
PRINT("Subtraction ";A;"-";B;"=";(A-B))
PRINT("Multiplication ";A;"*";B;"=";(A*B))
PRINT("Integer division ";A;"div";B;"=";(A DIV B))
PRINT("Remainder or modulo ";A;"mod";B;"=";(A MOD B))
PRINT("Power ";A;"^";B;"=";(A^B))
END PROGRAM
You may also check:How to resolve the algorithm History variables step by step in the Factor programming language
You may also check:How to resolve the algorithm Pangram checker step by step in the Python programming language
You may also check:How to resolve the algorithm Bitmap/Bézier curves/Cubic step by step in the Processing programming language
You may also check:How to resolve the algorithm Loops/Break step by step in the Ursa programming language
You may also check:How to resolve the algorithm Evolutionary algorithm step by step in the 8086 Assembly programming language