General information
Category:
Coding, syntax & commands
ok so I think he wants.
10 into 1 returns 10
10 into 2 returns 5,5
10 into 3 returns 4,4,2
10 into 4 returns 3,3,3,1
10 into 5 returns 2,2,2,2,2
past that gets tricky, 6 I guess would be 1,1,1,1,1,5 and 9 would be - 8 1's and a 2
so the routine needs to ceiling() up to 10/2 and int() past that. oh and anything that divides straight in we'll just return.
ok here's the routine for 3
inum = 3
out1 = 0
out2 = 0
if 10 % inum == 0 && just output if divides perfectly
out1 = 10/inum
out2 = 0
else
if inum < int(10/2) && int here because you'd want the int side of an 11/2
out1 = ceiling(10/inum)
else
out1 = int(10/inum)
endif
out2 = 10 - out1*(inum-1)
endif
? out1
? out2
&&you now know that if out2 is 0 then its out1 * inum
&&otherwise it's (inum - 1) * inum + out2
so replace those 10's with a variable and it should work I think, hope that's what you were going for.
Ken.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only