hey guys jst wanted to knw how can i separate an integer into a single digit..........e.g 12345 into '1','2',3','4','5'
The modulus operator can help with this assignment, e.g. 12345%10 will give you 5.
you can also use a mathematical operator...
easy to read and understand...
g=12345;
a=(g/10000);
b=(g/1000)-(a*10);
c=(g/100)-(a*100)-(b*10);
d=(g/10)-(a*1000)-(b*100)-(c*10);
e=g-(a*10000)-(b*1000)-(c*100)-(d*10);
where:
a=1
b=2
c=3
d=4
e=5
and g=12345
hoping this will help you..
Last edited on