Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Divide by some numbers
#1
Hello,

Is it possible to check a number 'x' how it can be divided into whole numbers. The division is only allowed by 10/5/2/1

So if a number x is 28

It should give 2 * 10 / 1 * 5 /1 * 2 and 1 * 1

For further usage these numbers should be stored.

Is this something what QM can do for me?

THX
#2
Macro Macro2201
Code:
Copy      Help
out
int x=28

int i10 i5 i2 i1
i10=x/10
i5=x%10/5
i2=x%10%5/2
i1=x%10%5%2

out F"{x} = {i10}*10 + {i5}*5 + {i2}*2 + {i1}*1"

% is division remainder operator.


Forum Jump:


Users browsing this thread: 3 Guest(s)