PDA

View Full Version : how to combine 3 variables in one variable consecutively ?



microb
- 16th June 2012, 11:49
hello
i am doing a timer but i want to combine 3 variable in one variable.
for example :

x var byte
y var byte
z var byte
num var word

x = 1
y=2
z = 3

i want num = zyx

i have a solution, but i am not satisfied to it. my solution is

y=y*10
z=z*100
then
num=x+y+z
but i am thinking if i use For statement, then the number will multiply by 10 and 100

microb
- 16th June 2012, 12:23
what about this solution ?

num = z*100 + y+10 + x