Babbage problem: Difference between revisions

m
→‎{{header|REXX}}: added wording to the REXX section header (preamble), pruned the last two outputs (saying that they're identical to the first).
m (improved alignment)
m (→‎{{header|REXX}}: added wording to the REXX section header (preamble), pruned the last two outputs (saying that they're identical to the first).)
Line 162:
 
=={{header|REXX}}==
If this were a computer program to be shown to a novice,computer itprogramming would have anovice   ''lot''(albeit   more comments which woulda explain:very
<br>intelligent polymath novice), &nbsp; the computer program would also have a &nbsp; <big>''lot''</big> &nbsp; more comments,
<br>notes, and accompanying verbiage which would/could/should explain:
 
:::* &nbsp; what a (computer program) comment looks like
:::* &nbsp; what area &nbsp; ''variables'' &nbsp; and how to store values in themcomputer is
:::* &nbsp; what a computer program is
:* &nbsp; how the &nbsp; '''do''' &nbsp; loop works (initial value, increment, etc)
:::* &nbsp; how ana assignmentcomputer &nbsp;stores <big>'''=''' </big> &nbsp;numbers assignmentand workssuch
:::* &nbsp; howwhat a comparisonare &nbsp; <big>'''=='variables'' </big>&nbsp; and how to store &nbsp; operator''stuff'' in them works
:::* &nbsp; how anthe &nbsp; '''ifdo''' &nbsp; statementloop works (initial value, increment, etc)
:::* &nbsp; whathow thean assignment &nbsp; <big>'''*=''' </big> &nbsp; operator is and what it does multiplicationworks
:::* &nbsp; whathow thea comparison &nbsp; <big>'''+==''' </big> &nbsp; operator is and what it does additionworks
:::* &nbsp; whathow thean &nbsp; <big>'''//if'''</big> &nbsp; operatorstatement is and what it does division remainderworks
:::* &nbsp; what thea &nbsp;(computer '''right'''program) &nbsp;statement BIFis does
:::* &nbsp; what athe &nbsp; <big>'''BIF*'''</big> &nbsp; operator is and how it returns adoes valuemultiplication
:::* &nbsp; how/whenwhat the &nbsp; <big>'''then+'''</big> &nbsp; causeoperator getsis executedand &nbsp;how (afterit andoes &nbsp; '''if''')addition
:::* &nbsp; explainwhat how/why anthe &nbsp; <big>'''end//'''</big> &nbsp; statementoperator is neededand forhow theit '''do'''does division loopremainder
:::* &nbsp; explainwhat how athe &nbsp; '''leaveright''' &nbsp; statementBIF worksdoes
:::* &nbsp; and<strike>who</strike> what thea &nbsp; '''sayBIF''' &nbsp; is problemand thehow onlyit statementreturns that isa self-explanatoryvalue
:::* &nbsp; how/when the &nbsp; '''then''' &nbsp; cause gets executed &nbsp; (after an &nbsp; '''if''')
:::* &nbsp; explain how/why an &nbsp; '''end''' &nbsp; statement is needed for a &nbsp; '''do''' &nbsp; loop
:::* &nbsp; explain how thea &nbsp; '''doleave''' &nbsp; loopstatement works (initial value, increment, etc)
:::* &nbsp; <big>···</big> the &nbsp; '''say''' &nbsp; is problem the only statement that is self-explanatory
===examine the right-most 6 digits of square===
<lang rexx>/*REXX program finds the lowest (positive) integer whose square ends in 269,696. */
Line 200 ⟶ 206:
 
say "The smallest integer whose square ends in 269,696 is: " j</lang>
'''output''' &nbsp; is identical as the 1<sup>st</sup> REXX version.
'''output'''
<pre>
The smallest integer whose square ends in 269,696 is: 25264
</pre>
 
===examine only numbers ending in 4 or 6===
Line 219 ⟶ 222:
 
say "The smallest integer whose square ends in 269,696 is: " k</lang>
'''output''' &nbsp; is identical as the 1<sup>st</sup> REXX version.
'''output'''
<prebr><br>
The smallest integer whose square ends in 269,696 is: 25264
</pre>
 
=={{header|Ruby}}==