Do while loops?? Please help

Discussion in 'JavaScript' started by Smilin, May 6, 2006.

  1. #1
    Hey guys.. I'm a newbie to JavaScript :eek:

    I'm new to the forums, so i hope im not doing anything wrong by posting this here :)
    Im reading from a worksheet i have here, and i dont quite understand it..
    Hopefully somebody else can lay it out in English for me? haha

    The question is as follows.

    "Write a program which takes a series of positive integers as input : 1, 2, 3 …
    When input is complete, as indicated by entry of an end of data flag ( -2), the program will output the largest of the entered values."


    Here's the pseudocode, or structured english? too it.


    INPUT number
    INPUT anotherNumber
    DOWHILE anotherNumber > 0
    IF anotherNumber > number
    SET number = anotherNumber
    ENDIF
    DISPLAY prompt for anotherNumber
    INPUT anotherNumber
    END DOWHILE
    DISPLAY number



    I've spent the last 3 hours trying to work it out, but im totally mind boggled now :eek:
    Any help at all is really appreciated, thank you :)
     
    Smilin, May 6, 2006 IP