How to resolve the algorithm Arithmetic/Integer step by step in the Fermat programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Arithmetic/Integer step by step in the Fermat 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 Fermat programming language

Source code in the fermat programming language

?a;
?b;
!!('Sum:              a+b=',a+b);
!!('Difference:       a-b=',a-b);
!!('Product:          a*b=',a*b);
!!('Integer quotient: a\b=',a\b);
!!('Remainder:        a|b=',a|b);
!!('Exponentiation:   a^b=',a^b);

  

You may also check:How to resolve the algorithm Comments step by step in the Plain English programming language
You may also check:How to resolve the algorithm Boolean values step by step in the KonsolScript programming language
You may also check:How to resolve the algorithm Dinesman's multiple-dwelling problem step by step in the Lua programming language
You may also check:How to resolve the algorithm Loops/Break step by step in the AWK programming language
You may also check:How to resolve the algorithm Maze generation step by step in the D programming language