Factors of an integer: Difference between revisions
Content added Content deleted
(Add Plain English) |
|||
Line 4,280: | Line 4,280: | ||
if mod(n, i) = 0 then put skip list (i); |
if mod(n, i) = 0 then put skip list (i); |
||
end;</lang> |
end;</lang> |
||
=={{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|PowerShell}}== |
=={{header|PowerShell}}== |