Arithmetic/Integer: Difference between revisions
Content added Content deleted
(Add Plain English) |
|||
Line 3,782: | Line 3,782: | ||
put skip list (mod(a, b)); /* Remainder is always positive. */ |
put skip list (mod(a, b)); /* Remainder is always positive. */ |
||
put skip list (rem(a, b)); /* Sign can be negative. */</lang> |
put skip list (rem(a, b)); /* Sign can be negative. */</lang> |
||
=={{header|Plain English}}== |
|||
<lang plainenglish>To run: |
|||
Start up. |
|||
Demonstrate integer arithmetic. |
|||
Wait for the escape key. |
|||
Shut down. |
|||
To demonstrate integer arithmetic: |
|||
Write "Enter a number: " to the console without advancing. |
|||
Read a number from the console. |
|||
Write "Enter another number: " to the console without advancing. |
|||
Read another number from the console. |
|||
Show the arithmetic operations between the number and the other number. |
|||
To show the arithmetic operations between a number and another number: |
|||
Write the number plus the other number then " is the sum." to the console. |
|||
Write the number minus the other number then " is the difference." to the console. |
|||
Write the number times the other number then " is the product." to the console. |
|||
Show the division of the number by the other number. |
|||
Raise the number to the other number. |
|||
Write the number then " is the power." to the console. |
|||
To show the division of a number by another number: |
|||
Privatize the number. |
|||
Divide the number by the other number giving a quotient [rounding toward zero] and a remainder [with the same sign as the dividend]. |
|||
Write the quotient then " is the quotient." to the console. |
|||
Write the remainder then " is the remainder." to the console.</lang> |
|||
{{out}} |
|||
<pre> |
|||
Enter a number: 44 |
|||
Enter another number: 3 |
|||
47 is the sum. |
|||
41 is the difference. |
|||
132 is the product. |
|||
14 is the quotient. |
|||
2 is the remainder. |
|||
85184 is the power. |
|||
</pre> |
|||
=={{header|Pop11}}== |
=={{header|Pop11}}== |