I have a problem with printing on 7 segment display with cd4511

Hello. i have a serious problem with my multiplexed circuit its a 3digit 7 segment display twice 2 temp reader and 2 cd4511 i ive put my code and for the 1 set of temp and 3 digits worked nice but the second set prints on the 3 digit 7 segment doubled value i dont know what it is and i cant find the problem so i ask your help.

My circuit is here :

Here is the Code:

int temperature;
int second;
// Arduino pins connected to the 4511
const uint8_t LedA = 5;
const uint8_t LedB = 8;
const uint8_t LedC = 7;
const uint8_t LedD = 6;
const uint8_t LeA = 9;
const uint8_t LeB = 10;
const uint8_t LeC = 11;
const uint8_t LeD = 12;

// Arduino pins connected to the segment driver transistors
const uint8_t Led1 = 13;
const uint8_t Led2 = 2;
const uint8_t Led3 = 3;
const uint8_t Led4 = 4;
const uint8_t Led5 = A2;
const uint8_t Led6 = A3;
const uint8_t Led7 = A4;
const uint8_t Led8 = A5;
void setup()
{
  // Let the Arduino know which pins go where
  pinMode(LedA, OUTPUT);
  pinMode(LedB, OUTPUT);
  pinMode(LedC, OUTPUT);
  pinMode(LedD, OUTPUT);
  pinMode(LeA, OUTPUT);
  pinMode(LeB, OUTPUT);
  pinMode(LeC, OUTPUT);
  pinMode(LeD, OUTPUT);

  pinMode(Led1, OUTPUT);
  pinMode(Led2, OUTPUT);
  pinMode(Led3, OUTPUT);
  pinMode(Led4, OUTPUT);
  pinMode(Led5, OUTPUT);
  pinMode(Led6, OUTPUT);
  pinMode(Led7, OUTPUT);
  pinMode(Led8, OUTPUT);

  
  digitalWrite(Led1, LOW);
  digitalWrite(Led2, LOW);
  digitalWrite(Led3, LOW);
  digitalWrite(Led4, LOW);
  digitalWrite(Led5, LOW);
  digitalWrite(Led6, LOW);
  digitalWrite(Led7, LOW);
  digitalWrite(Led8, LOW);
      
  Serial.begin(9600);

}

void loop()
{
 
temperature = -40 + 0.488155 * (analogRead(A0) - 20);
second =  -40 + 0.488155  * (analogRead(A1) - 20);
 print_number(temperature);
 print_number2(second);
  Serial.print ("IN ");
  Serial.print(temperature);
  Serial.println(" C");
  Serial.print ("OUT ");
  Serial.print(second);
  Serial.println(" C");

}
void print_number(unsigned i) {
  static int l = 2;
  
  set_digit(Led3, l, i/10 );
  set_digit(Led2, l, i/1  );
}

void print_number2(unsigned n) {
  static int d = 1;
  
  set_digit2(Led7, d, n/10 );
  set_digit2(Led6, d, n/1  );
}

void set_digit(const uint8_t sec, const unsigned l, const unsigned value) {
  set_number(value);
  digitalWrite(sec, HIGH);
  delay(l);
  digitalWrite(sec, LOW);
}

void set_digit2(const uint8_t led, const unsigned d, const unsigned value2) {
  set_number2(value2);
  digitalWrite(led, HIGH);
  delay(d);
  digitalWrite(led, LOW);
}


void set_number(const unsigned i) {
  static const struct number {
    uint8_t d;
    uint8_t c;
    uint8_t b;
    uint8_t a;
  } numbers[] = {
    { LOW,  LOW,  LOW,  LOW}, /* 0 */
    { LOW,  LOW,  LOW, HIGH}, /* 1 */
    { LOW,  LOW, HIGH,  LOW}, /* 2 */
    { LOW,  LOW, HIGH, HIGH}, /* 3 */
    { LOW, HIGH,  LOW,  LOW}, /* 4 */
    { LOW, HIGH,  LOW, HIGH}, /* 5 */
    { LOW, HIGH, HIGH,  LOW}, /* 6 */
    { LOW, HIGH, HIGH, HIGH}, /* 7 */
    {HIGH,  LOW,  LOW,  LOW}, /* 8 */
    {HIGH,  LOW,  LOW, HIGH}, /* 9 */
  };
  
  digitalWrite(LedA, numbers[i%10].a);
  digitalWrite(LedB, numbers[i%10].b);
  digitalWrite(LedC, numbers[i%10].c);
  digitalWrite(LedD, numbers[i%10].d);

}
  void set_number2(const unsigned n) {
  static const struct number {
    uint8_t d;
    uint8_t c;
    uint8_t b;
    uint8_t a;
  } numbers[] = {
    { LOW,  LOW,  LOW,  LOW}, /* 0 */
    { LOW,  LOW,  LOW, HIGH}, /* 1 */
    { LOW,  LOW, HIGH,  LOW}, /* 2 */
    { LOW,  LOW, HIGH, HIGH}, /* 3 */
    { LOW, HIGH,  LOW,  LOW}, /* 4 */
    { LOW, HIGH,  LOW, HIGH}, /* 5 */
    { LOW, HIGH, HIGH,  LOW}, /* 6 */
    { LOW, HIGH, HIGH, HIGH}, /* 7 */
    {HIGH,  LOW,  LOW,  LOW}, /* 8 */
    {HIGH,  LOW,  LOW, HIGH}, /* 9 */
  };
  
  digitalWrite(LeA, numbers[n%10].a);
  digitalWrite(LeB, numbers[n%10].b);
  digitalWrite(LeC, numbers[n%10].c);
  digitalWrite(LeD, numbers[n%10].d);
    
  }

and i cant display C on the digit and minus temperatures on minus temps writes weird numbers… the C is fixed if it is any way to fix those 3 problems?

Thanks in advance
Banned_L

Try n/10 and n%10 for the two digits of a number in the range 0..99

on

void print_number2(unsigned n) {
  static int d = 1;
  
  set_digit2(Led7, d, n/10 );
  set_digit2(Led6, d, n/1  );

change the n/10 , n/1 to n%10 n%1 ?

and on

digitalWrite(LeA, numbers[n%10].a);
  digitalWrite(LeB, numbers[n%10].b);
  digitalWrite(LeC, numbers[n%10].c);
  digitalWrite(LeD, numbers[n%10].d);

the n% to n/ ? or just for that to tweak the number 10 till i get the result i want?

and for what problem is this … Please specify it please

can someone please help?