Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Babbage-problem/Processing/babbage-problem.processing
Normal file
34
Task/Babbage-problem/Processing/babbage-problem.processing
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// Lines that begin with two slashes, thus, are comments: they
|
||||
// will be ignored by the machine.
|
||||
|
||||
// First we must declare a variable, n, suitable to store an integer:
|
||||
|
||||
int n;
|
||||
|
||||
// Each statement we address to the machine must end with a semicolon.
|
||||
|
||||
// To begin with, the value of n will be zero:
|
||||
|
||||
n = 0;
|
||||
|
||||
// Now we must repeatedly increase it by one, checking each time to see
|
||||
// whether its square ends in 269,696.
|
||||
|
||||
// We shall do this by seeing whether the remainder, when n squared
|
||||
// is divided by one million, is equal to 269,696.
|
||||
|
||||
do {
|
||||
n = n + 1;
|
||||
} while (n * n % 1000000 != 269696);
|
||||
|
||||
// To read this formula, it is necessary to know the following
|
||||
// elements of the notation:
|
||||
// * means 'multiplied by'
|
||||
// % means 'modulo', or remainder after division
|
||||
// != means 'is not equal to'
|
||||
|
||||
// Now that we have our result, we need to display it.
|
||||
|
||||
// println is short for 'print line'
|
||||
|
||||
println(n);
|
||||
Loading…
Add table
Add a link
Reference in a new issue