Sha256: 95f4f009d9ed9554f29f96a2324f0e80f5ff1d582dcb9a41e69fe165610b17fd
Contents?: true
Size: 524 Bytes
Versions: 10
Compression:
Stored size: 524 Bytes
Contents
Integer quotient (`//`) rounds towards 0. Remainder (`rem`) matches the sign of its first operand. print_expression_and_result(M, N, Operator) :- Expression =.. [Operator, M, N], Result is Expression, format('~w ~8|is ~d~n', [Expression, Result]). arithmetic_integer :- read(M), read(N), maplist( print_expression_and_result(M, N), [+,-,*,//,rem,^] ). Use thus: ?- arithmetic_integer. |: 5. |: 7. 5+7 is 12 5-7 is -2 5*7 is 35 5//7 is 0 5 rem 7 is 5 5^7 is 78125 true.
Version data entries
10 entries across 7 versions & 1 rubygems