Get the values from LM35 in binary to control a 7 segment display

Hello

What I need to do is to get the values from the LM35 and turn them into a BCD equivalent. I already have code to turn the values into decimal numbers, but I need the MSB and the LSB to be converted into a binary value and get them to an output. For example:
If the sensor displays the value "27", for the MSB, I need that the following pins output that value.

1 Low
2 Low
3 High
4 Low

And for the LSB

5 Low
6 High
7 High
8 High

According to what I have researched, I need to separate them into arrays, but I've never used an Arduino before in my life.
Thanks in advance

Would this help

byte bcdFromInt(int input)
{
byte byteVal= (input/10) * 16;
byteVal += input %10;
return byteVal; 
}

Oh…I see. After that, I need to select to which pins they output, right?

my code is as follows

Sorry for my ignorance, but I really want to learn

what i have.txt (498 Bytes)

Sorry I don't have a clue how you have your 7 segment displays connected. I just noticed you wanted a value converted into BCD.