babbage.frink

View or download 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
}


View or download 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 18660 days, 3 hours, 3 minutes ago.