How to Prevent looping in ' if '

hai , i have written a program to control my led light based on different battery voltages.

void load_control()
{
if(bat_volt > 12.4) // check if battery is healthy
{
load_status=1;
loaduty = 252.45 * 0.95;
analogWrite(LOAD_PIN,loaduty);
}

else if(bat_volt > 12 && bat_volt <= 12.4)
{
load_status=1;
loaduty = 252.45 * 0.80;
analogWrite(LOAD_PIN,loaduty);
}

else if(bat_volt <= 12 )
{
load_status=0;
loaduty = 252.45 ;
analogWrite(LOAD_PIN, LOW); //load is OFF
}
}

But the problem is that as soon as the voltage reduces below 12.4 V, the load voltage reduces which reduces the current usage. As the load stress in battery decreases the battery voltage increases which makes the previous condition valid and load voltage increases. So the led light starts to blink because of the looping between two conditions. This happens for at least 3 minutes until the battery voltage become settled at lower than the first condition.

So please help me to write a code such that once the second condition is satisfied it should never go back to the first condition unless the battery is fully charged.

Set a flag variable in the second condition. Test for that flag variable in the first condition. Add another condition that resets the flag variable when the battery is fully charged:

if(bat_volt > 12.4 && batteryIsFullyCharged == true)   // check if battery is healthy