Computer Science Canada Need help with this program.. |
Author: | Fatalsh0ts [ Sun Jun 14, 2009 2:45 pm ] |
Post subject: | Need help with this program.. |
1. Write a program that continually asks a user for a number until they enter 0. Output the lowest number that they entered. this is what i have so far. var numb, numb2 : real put "Enter a number: " .. get numb for x : 1 .. 1000 if numb > 0 then put "Enter a number: " .. get numb elsif numb = 0 then exit end if end for i dont know how ot output the lowest number |
Author: | DtY [ Sun Jun 14, 2009 3:00 pm ] |
Post subject: | RE:Need help with this program.. |
You have to store the lowest number as you're going through. If they enter a number lower than the lowest number, that new number is the lowest. And use loop instead of for. |
Author: | BigBear [ Sun Jun 14, 2009 3:00 pm ] |
Post subject: | RE:Need help with this program.. |
You should use a conditional loop because a for loop exits after a certain amount of times in your code 1000 times. But what if they enter 100 numbers and none of them are 0 You also need to store the lowest entered |
Author: | Kharybdis [ Sun Jun 14, 2009 3:19 pm ] | ||
Post subject: | Re: Need help with this program.. | ||
Something like this maybe. This is done to find the largest integer entered..
|