Re: Requesting help again... as a beginner....

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...

Part of the problem is that we don't actually know what you are trying to do. I'm guessing now, that you want the user to enter an odd number and your program will calculate what the square of that number is, and then display the result. Is that it? If so, try this version ...

sequence range 
atom h, t 
range = {3,10000} 
 
while 1 do 
    t = prompt_number("\nPlease enter a positive odd number greater than 2: ", range) 
    if not and_bits(t,1) then 
        puts(1,"\nThat is not an  odd number, try again.") 
    else 
        h = power(t,2) 
        printf(1, "%d squared is %d\n", {t,h}) 
    end if 
 
end while 

Thanks, this helps a lot, I think I don't need anymore help, but if I do I'll come back and ask. Thanks everyone!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu