I want to make sure I understand. You want to have the user input a number and have the program return the number of thousands, the number of hundreds, the number of tens, and the number of ones?
so please work out an example for me. let say:
how wilthe program look like?
Do you want it to say "Hunderds: 0" or suppress it?
should it catch if the number is XXXXX an integer?
pls both if u don't mind
Not a problem.
Do you want me to explain the run of the program, or just type it up?\
type it then explain
Ok, give me a couple minutes, and I will type up a word file.
ok i will be waiting
start: Input x
if x<0 or x>99999 or x<>int(x) then goto start
q=int(x/1000): if q>0 then print “Thousands:”; q: x=x-1000*q
q=int(x/100): if q>0 then print “Hundreds:”;q: x=x-100*q
q= int(x/10): if >0 then print “Tens:”; q: x=x-10*q
if x>0 then print “Ones:”; x
The first line puts a label and asks for input
the second catches negative number, numbers that are too large, and non-integers
the next line calls the number of thousands Q and prints how many there are, and reduces x by that many thousands.
the next lines do the same for hundreds, tens, and ones.
oops. I missed a q on the "tens" line.
I'm sure you can make it look fancier with a message of some kind on line 2 and some more wording with the messages, of you wanted.
You also probably want a better prompt for the user than just a ? for them to input the number.
ok so basically am am i doing a division operation?
I just gave the skeleton on the program.
yeah i konw
"int" returns the integer of a division problem.
thanks let me work my way around it and get back to u should i not get something.
If you start with a number like 14358, the first line divides that by 1000, gets 14.358 and int makes it 14.
it prints the 14, and then takes 14*1000 away from x, so 14358-14000=358
Hmmm. You don't want it to say that there are 143 hundreds in that example, so you?
You want 14 thousands, 3 hundred, 5 tens, and 8 ones, right?
oh, good. I w2as afraid I misunderstood.
I will be here most of the day if you have any questions. When you are satisfied, please remember to rate my answer.
so x is what the person will input right
q=int(x/1000): if q>0 then print "Thousands:"; q: x=x-1000*q
q=int(x/100): if q>0 then print "Hundreds:";q: x=x-100*q
q= int(x/10): if >0 then print "Tens:"; q: x=x-10*q
if x>0 then print "Ones:"; x
thanks so much
hi good day