Delay in Responseom ultrasonic sensor HC-SR04

PROBLEM:-
the sensor 1 when obstacle is frnt the Bot is not stopping and there is a delay of 5 sec to stop and vibration is added as a alert system to Human the twist is when a obstacle comes the vibration comes with great delay and when there is obstacle the sensor should wait for 5 sec and then automatically go right then left so it would cut the obstacle
THE CODE IS GIVEN BELOW

int trig1 =13,echo1=12,trig2=11,echo2=10 ;
int lftmtr=7,rgtmtr=8;
int vibr=4;
int l=100,r=100,i=0,j=0;
void setup() {
// put your setup code here, to run once:
pinMode(lftmtr,OUTPUT);
pinMode(rgtmtr,OUTPUT);
pinMode(trig1,OUTPUT);
pinMode(trig2,OUTPUT);
pinMode(echo1,INPUT);
pinMode(echo2,INPUT);
pinMode(vibr,OUTPUT);
Serial.begin(9600);
}
float distance1, distance2, duration1, duration2 ;
void loop() {
// put your main code here, to run repeatedly:

a:
digitalWrite(trig1,LOW); // for straight sensor
delay(2);
digitalWrite(trig1,HIGH);
delay(10);
digitalWrite(trig1,LOW);
duration1 = pulseIn(echo1,HIGH);
distance1 = (duration1/2)/29.1;
Serial.print(distance1);
Serial.println();
delay(500);

digitalWrite(trig2,LOW); // for down sensor
delay(2);
digitalWrite(trig2,HIGH);
delay(10);
digitalWrite(trig2,LOW);
duration2 = pulseIn(echo2,HIGH);
distance2 = (duration2/2)/29.1;
Serial.print(distance2);
Serial.println();
delay(500);

if(distance2>10) // step encountered
{digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,LOW);
digitalWrite(vibr,HIGH);
delay(5000);
digitalWrite(vibr,LOW);

goto a;
}

if(distance1>15) // moving straight
{ digitalWrite(lftmtr,HIGH);
digitalWrite(rgtmtr,HIGH);
delay(300);
digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,LOW);
goto a;
}

if(distance1<15 && i==0) // encountered an obstacle
{digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,LOW);
i=1;
delay(1000); // waiting
goto a; }

b:
if(i==0 && j==1)
{ digitalWrite(lftmtr,HIGH);
digitalWrite(rgtmtr,HIGH);
delay(1000);
digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,LOW);

if(r>l)
{digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,HIGH);
delay(2000);
{l++;
r–;}
digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,LOW);
goto a;}

}

if(i==1 && distance1<15 )
{ if(l>=r) // turn right
{digitalWrite(lftmtr,HIGH);
digitalWrite(rgtmtr,LOW);
delay(2000); // refine this delays
{r++;
l–;}
digitalWrite(lftmtr,LOW);
digitalWrite(rgtmtr,LOW);
i=0; j=1; goto b;}

}

}

SHARING IS CARING

Please rewrite the program without using goto as I got lost in spaghetti code when trying to understand the current program.

Insted of goto what to do ?? i am Beginner please expain in detail

vibhoothiiaanand: Insted of goto what to do ??

While loops or a state machine.