binary

i have to create a program that separates 2 decimal digits. For example, the number 89 would become number 8 and 9 on two separate outputs. Number 8 would be multiplied by 16 and then 9 would be added for the converted binary value.
i am using this program with seven segment display. Im new to programming so any ideas how i may start?

The only thing you would need to know is the % (modulo) operator. It gives you the remainder of division, so 89 %10 would give you 9, and then you could subtract 9 from 89 and divide the resulting 80 by 10 to get 8. ;)
modulo by 10, then integer divide by 10.
i am still confused, do u mind showing me ?
1
2
3
int number = 89;
int ones_digit = number % 10;
int tens_digit = (number - ones_digit) / 10;
Topic archived. No new replies allowed.