How to resolve the algorithm Arithmetic/Integer step by step in the ALGOL 68 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Arithmetic/Integer step by step in the ALGOL 68 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 ALGOL 68 programming language
Source code in the algol programming language
main:(
LONG INT a=355, b=113;
printf(($"a PLUS b = a+b = "gl$, a + b));
printf(($"a MINUS b = a-b = "gl$, a - b));
printf(($"a TIMES b = a*b = a×b = "gl$, a * b));
printf(($"a DIV b = a/b = "gl$, a / b));
printf(($"a OVER b = a%b = a÷b = "gl$, a % b));
printf(($"a MOD b = a%*b = a%×b = a÷×b = a÷*b = "gl$, a %* b));
printf(($"a UP b = a**b = a↑b = "gl$, a ** b))
)
You may also check:How to resolve the algorithm Ackermann function step by step in the AArch64 Assembly programming language
You may also check:How to resolve the algorithm Variadic function step by step in the Quackery programming language
You may also check:How to resolve the algorithm Primality by Wilson's theorem step by step in the Tiny BASIC programming language
You may also check:How to resolve the algorithm Fermat numbers step by step in the Perl programming language
You may also check:How to resolve the algorithm N'th step by step in the Joy programming language