Making two if Statements work at the same time

Hi everyone, just want to ask how am I suppose to make two if statements to operate at the same time? I mean in this setup,

there are two level sensors that act as input, if they are triggered, they will trigger their corresponding pumps. however, the result is this;

the if statement #2 does not operate while the if statement 1 is satisfied/triggered. how can I make these two statements independent from each other?

const int level1 = 2;
const int level2 = 3;
const int pump1 = 4;
const int pump2 = 5;

void setup()
{

  pinMode(level1, INPUT_PULLUP);
  pinMode(level2, INPUT_PULLUP);
  pinMode(pump1, OUTPUT);
  pinMode(pump2, OUTPUT);
}

void loop()
{
  int state1 = digitalRead(level1);
  int state2 = digitalRead(level2);
  
    if(state1==0)
    {
      digitalWrite(pump1, HIGH);
    }
    else
    {
    digitalWrite(pump1, LOW);
    
    if(state2==0)
    {
      digitalWrite(pump2, HIGH);
    }
    else
    {
      digitalWrite(pump2, LOW);
    }
   
    
  }
  
  
  
}

You seem to have lost track of where your braces are. The 2nd if() is part of the else of the 1st if().

    if(state1==0)
    {
      digitalWrite(pump1, HIGH);
    }
    else
    {
      digitalWrite(pump1, LOW);
    
// ------------------------ so why is this block inside of that else if you want them separate?
      if(state2==0)
      {
        digitalWrite(pump2, HIGH);
      }
      else
      {
        digitalWrite(pump2, LOW);
      }
// ---------------------------------------------------------------- hmmmm?
  }

You may have another problem when you get that fixed. If one pump fills and the other empties then you will make dueling pumps.