How to resolve the algorithm Even or odd step by step in the Bracmat programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Even or odd step by step in the Bracmat programming language
Table of Contents
Problem Statement
Test whether an integer is even or odd. There is more than one way to solve this task:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Even or odd step by step in the Bracmat programming language
Source code in the bracmat programming language
( ( even
=
. @( !arg
: ?
[-2
( 0
| 2
| 4
| 6
| 8
)
)
)
& (odd=.~(even$!arg))
& ( eventest
=
. out
$ (!arg is (even$!arg&|not) even)
)
& ( oddtest
=
. out
$ (!arg is (odd$!arg&|not) odd)
)
& eventest$5556
& oddtest$5556
& eventest$857234098750432987502398457089435
& oddtest$857234098750432987502398457089435
)
You may also check:How to resolve the algorithm Pernicious numbers step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Kolakoski sequence step by step in the V (Vlang) programming language
You may also check:How to resolve the algorithm Literals/String step by step in the Quackery programming language
You may also check:How to resolve the algorithm Truth table step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Associative array/Iteration step by step in the PostScript programming language