// File: displaySquareAndSquareRoot1_0.nxc // Date: 08/31/12 13:04 // Desc: Display number, its square and square root // Vers: 1.0 - works! task main () { int x; // integers from 1 to 10 int xSquared; // square of x float xSquareRoot; // square root of x for (x = 1; x <=10; x++) { xSquared = x*x; xSquareRoot = sqrt(x); // TextOut (xPosition, yPosition, string) put string on LCD's x,y position // NB: x = y = 0 is lower left corner of LCD; +x goes rights, +y goes up // FormatNum is a string with sprintf syntax TextOut (10, LCD_LINE4, FormatNum("x = %d" , x)); TextOut (10, LCD_LINE5, FormatNum("xSquared = %d" , xSquared)); TextOut (10, LCD_LINE6, FormatNum("sqrt(x) = %3.3f" , xSquareRoot)); Wait (SEC_2); } }