BoutCheetah

Other => Spam => Topic started by: Pokeh on April 11, 2014, 10:16:26 PM

Title: is this right pseudocode
Post by: Pokeh on April 11, 2014, 10:16:26 PM
QuoteWrite a program to read in a series of integers and print out only the odd numbers over 1000.  At the end the program should also print out how many such numbers were found.

It's a hell of a lot easier than the assembler problem..

i have this so far:

in x
While
  if x>1000 then load y
  SET x=y/2
  If x=1 then Add 1 to counter
End While
Print X
Print Counter
Halt


Basically if the numbers going to be odd and I continue to divide by 2, I should get a 1. If that's the case and the numbers over 1000 then it adds 1 to the counter.

How do I get it to say x=x/2 until it reaches 0 or 1?


EDIT: i fixed it. just tell me if its right or not
Title: Re: is this right pseudocode
Post by: Pokeh on April 12, 2014, 02:50:47 AM
ok ty