Factors of an integer: Difference between revisions

Content added Content deleted
m (→‎{{header|PL/I}}: Fixed link)
(Moved Polyglot:PL/I and PL/M into the correct place)
Line 5,037: Line 5,037:


See [[#Polyglot:PL/I and PL/M]]
See [[#Polyglot:PL/I and PL/M]]

=={{header|Plain English}}==
<lang plainenglish>To run:
Start up.
Show the factors of 11.
Show the factors of 21.
Show the factors of 519.
Wait for the escape key.
Shut down.

To show the factors of a number:
Write "The factors of " then the number then ":" on the console.
Find a square root of the number.
Loop.
If a counter is past the square root, write "" on the console; exit.
Divide the number by the counter giving a quotient and a remainder.
If the remainder is 0, show the counter and the quotient.
Repeat.

A factor is a number.

To show a factor and another factor:
If the factor is not the other factor, write "" then the factor then " " then the other factor then " " on the console without advancing; exit.
Write "" then the factor on the console without advancing.</lang>
{{out}}
<pre>
The factors of 11:
1 11
The factors of 21:
1 21 3 7
The factors of 519:
1 519 3 173
</pre>


=={{header|Polyglot:PL/I and PL/M}}==
=={{header|Polyglot:PL/I and PL/M}}==
Line 5,100: Line 5,133:
FACTORS OF: 99: 1 3 9 11 33 99
FACTORS OF: 99: 1 3 9 11 33 99
FACTORS OF: 100: 1 2 4 5 10 20 25 50 100
FACTORS OF: 100: 1 2 4 5 10 20 25 50 100
</pre>

=={{header|Plain English}}==
<lang plainenglish>To run:
Start up.
Show the factors of 11.
Show the factors of 21.
Show the factors of 519.
Wait for the escape key.
Shut down.

To show the factors of a number:
Write "The factors of " then the number then ":" on the console.
Find a square root of the number.
Loop.
If a counter is past the square root, write "" on the console; exit.
Divide the number by the counter giving a quotient and a remainder.
If the remainder is 0, show the counter and the quotient.
Repeat.

A factor is a number.

To show a factor and another factor:
If the factor is not the other factor, write "" then the factor then " " then the other factor then " " on the console without advancing; exit.
Write "" then the factor on the console without advancing.</lang>
{{out}}
<pre>
The factors of 11:
1 11
The factors of 21:
1 21 3 7
The factors of 519:
1 519 3 173
</pre>
</pre>