Ways to make my code short or efficient?

I’ve done a switching digits and increment it by 1, is there any other way to make my code shorter. The code works fine but I want it to be efficient is there any other way?

const byte segment_a = 11; 
const byte segment_b = 12; 
const byte segment_c = 13; 
const byte segment_d = 14; 
const byte segment_e = 15; 
const byte segment_f = 16; 
const byte segment_g = 17; 
const byte segment_dp = 18; 
const byte digit1 = 10; 
const byte digit2 = 8; 
const byte digit3 = 7; 
int b1, b2;
int inc1 = 0;
int inc2 = 0;

void setup() 
{ 
  pinMode(segment_a, OUTPUT); 
  pinMode(segment_b, OUTPUT); 
  pinMode(segment_c, OUTPUT); 
  pinMode(segment_d, OUTPUT); 
  pinMode(segment_e, OUTPUT); 
  pinMode(segment_f, OUTPUT); 
  pinMode(segment_g, OUTPUT); 
  pinMode(segment_dp, OUTPUT); 
  pinMode(digit1, OUTPUT); 
  pinMode(digit2, OUTPUT); 
  pinMode(digit3, OUTPUT);
}

void loop() 
{  
  b1 = digitalRead(2);
  if (b1 == HIGH) {
  inc1++; 
  btn1(inc1);  
    if(inc1 > 2) {
     inc1 = 0;
    } 
  delay(500);
  }

  b2 = digitalRead(3);
  if (b2 == HIGH) { 
  inc2++; 
  btn2(inc2);
    if(inc2 == 10) {
     inc2 = 0;
    }  
  delay(500); 
  }     
}

void btn1(int x)
{
  
  if(x == 1) { 
    clearAll();
    inc2 = 0;
    digitalWrite(digit1, OUTPUT);
    digitalWrite(segment_a, LOW); 
    digitalWrite(segment_b, LOW); 
    digitalWrite(segment_c, LOW); 
    digitalWrite(segment_d, LOW); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, LOW); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);    
  }
    
  if(x == 2)
  {
    clearAll();
    inc2 = 0;
    digitalWrite(digit2, OUTPUT);
    digitalWrite(segment_a, LOW); 
    digitalWrite(segment_b, LOW); 
    digitalWrite(segment_c, LOW); 
    digitalWrite(segment_d, LOW); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, LOW); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);
  }
    
  if(x == 3)
  { 
    clearAll();
    inc2 = 0;
    digitalWrite(digit3, OUTPUT);
    digitalWrite(segment_a, LOW); 
    digitalWrite(segment_b, LOW); 
    digitalWrite(segment_c, LOW); 
    digitalWrite(segment_d, LOW); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, LOW); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);
  }

}

void btn2(int x)
{
  if (x == 1)
  {   
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, LOW); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, LOW); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, LOW); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);
   }
   
  if (x == 2)
  {    
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, LOW); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, HIGH); 
    digitalWrite(segment_f, LOW); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);
  }
  
  if (x == 3)
  {     
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, LOW); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);
  }
  
  if (x == 4)
  {     
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, LOW); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, LOW); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);
  }
  
  if (x == 5)
  {     
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, LOW); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);
  }
  
  if (x == 6)
  { 
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, LOW); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, HIGH); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);
  }
  
  if (x == 7)
  {     
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, LOW); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);
  }
  
  if (x == 8)
  { 
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, HIGH); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);;
  }
  
  if (x == 9)
  { 
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, LOW); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, HIGH); 
    digitalWrite(segment_dp, HIGH);
  }  
  
  if (x == 10)
  { 
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, HIGH); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);
  }  
}

void clearAll() 
{ 
  digitalWrite(digit1, LOW); 
  digitalWrite(digit2, LOW); 
  digitalWrite(digit3, LOW); 
 
  digitalWrite(segment_a, LOW); 
  digitalWrite(segment_b, LOW); 
  digitalWrite(segment_c, LOW); 
  digitalWrite(segment_d, LOW); 
  digitalWrite(segment_e, LOW); 
  digitalWrite(segment_f, LOW); 
  digitalWrite(segment_g, LOW); 
  digitalWrite(segment_dp, LOW); 
 }

is there any other way?

Sure. You can give functions meaningful names. The Arduino team chose digitalRead(), for instance, not D77444(). Only you can guess what btn1() is doing.

In those functions, you have a series of if statements, a maximum of which one can be true. Use else ifs or a switch statement.

Do not have the same code in all of the bodies/cases. There is no need to call clearAll() if x is 1 or if x is 2 or if x is 3. Just call clearAll().

There is very little difference between showing a 3 in position 1 or position 2 or position 3. You should have one function that can display a number in a position.

void showDigit(byte val, byte pos)
{
   // Some code
}

...

    showDigit(3, 0);
    showDigit(7, 1);
    showDigit(8, 2);

The second argument to digitalWrite() is NEVER OUTPUT.

this is a start but you could use a function to handle all digits and pas simple byte numbers to control all digits

  if (x == 10)
  { 
    
    Segment(B10111111,B0,B1);
    /* replaces:
    digitalWrite(inc1, HIGH); 
    digitalWrite(segment_a, HIGH); 
    digitalWrite(segment_b, HIGH); 
    digitalWrite(segment_c, HIGH); 
    digitalWrite(segment_d, HIGH); 
    digitalWrite(segment_e, HIGH); 
    digitalWrite(segment_f, HIGH); 
    digitalWrite(segment_g, LOW); 
    digitalWrite(segment_dp, HIGH);
    */
  }  
}

void clearAll() 
{ 
  Segment(B0,B0,B0);
}

 void Segment(byte Seg, byte digit,byte inc1){
  digitalWrite(inc1, inc1); 
  
  digitalWrite(digit1, bitRead(digit, 1)); 
  digitalWrite(digit2, bitRead(digit, 2)); 
  digitalWrite(digit3, bitRead(digit, 3)); 

  digitalWrite(segment_a, bitRead(Seg, 0)); 
  digitalWrite(segment_b, bitRead(Seg, 1)); 
  digitalWrite(segment_c, bitRead(Seg, 2)); 
  digitalWrite(segment_d, bitRead(Seg, 3)); 
  digitalWrite(segment_e, bitRead(Seg, 4)); 
  digitalWrite(segment_f, bitRead(Seg, 5)); 
  digitalWrite(segment_g, bitRead(Seg, 6)); 
  digitalWrite(segment_dp, bitRead(Seg, 7));
 }

Z