babbage.frink

Download or view babbage.frink in plain text format


// This is a solver for the Rosetta Code problem "Babbage problem"
// https://rosettacode.org/wiki/Babbage_problem

i = 1

while true
{
    // mod is the modulus operator.
    // The == operator is a test for equality.  A single = 
    // assigns to a variable.
    if i² mod million == 269696
    {
       // This prints i and i²
       println[i + "² = " + i²]
       exit[]    // This terminates the program.
    }
    i = i + 1
}


Download or view babbage.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19966 days, 4 hours, 44 minutes ago.