35 lines
913 B
Plaintext
35 lines
913 B
Plaintext
// 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);
|