split a number up for the 3 digits

I have a number up to 999, and now I want to send that data to three 7 segment LEDS.

Is there some standard way that is used to do the math of ones tens etc, to break that number down into the single digit components to send to each display?

Thanks!

uint8_t ones,tens,hundreds;

hundreds = number/100;
number = number-hundreds*100;

tens = number/10;
ones = number-tens*10;

--
The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected

db2db:
I have a number up to 999, and now I want to send that data to three 7 segment LEDS.

Is there some standard way that is used to do the math of ones tens etc, to break that number down into the single digit components to send to each display?

Thanks!

first=number/100;
second=number%100/10;
third=number%10;

This looks nice and easy.

Much appreciated.

No problem. This question is quite typical and gets asked like once a week. :smiley:

I assumed so, but could not find it on here.

Thanks.

db2db:
I assumed so, but could not find it on here.

Thanks.

They don't always manifest the same way but this one I answered was pretty similar. Don't worry. It's a typical thing that we help newbies with the same questions over and over, as long as they're respecting the forum and provide enough information to get answers.