HC sr04 serial monitor values(distance) not being displayed.

LOGIC of my project:
vibratory patterns as a feedback from the vibrator motor in the given distance ranges are being given to the user once it detects an obstacle…
How to shorten up this below mentioned sketch…?
program and interfacing of hardware was done accordingly as per the sketch below:

#define trigPin 12
#define echoPin 9
#define motorPin 3

void setup()
{
Serial.begin (9600);
pinMode(echoPin,INPUT);
pinMode(trigPin,OUTPUT);
}
void loop()
{
int distance;
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
int duration = pulseIn(echoPin, HIGH);//datatype for duration suggest please…int datatype is well and working neways.should i go with that
distance = (duration/2) / 29.1;
Serial.print(distance);
Serial.println(" cm");
delay(1000);

if (distance <350 && distance >250)
{
analogWrite(motorPin,255);
** delay(50);**
** analogWrite(motorPin,0);**
** delay(50);**
** analogWrite(motorPin,255);**
** delay(50);**
** analogWrite(motorPin,0);**
** delay(450);**//the bold code in every if else statement is to be looped for different times.so is there any better way to do so.here this is being repeated 1 time aftr this

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(50);
analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(450);
}
else if (distance <250 && distance >150)
{
analogWrite(motorPin,255);
** delay(50);**
** analogWrite(motorPin,0);**
** delay(500);** repeated for 2 times after this

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(500);

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(500);
}
else if (distance <150 && distance >75)
{
analogWrite(motorPin,255);
** delay(50);**
** analogWrite(motorPin,0);**
** delay(50);**
** analogWrite(motorPin,255);**
** delay(50);**
** analogWrite(motorPin,0);**
** delay(200);** repeated for 3 times after this

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(50);
analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(200);

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(50);
analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(200);

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(50);
analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(200);
}
else if (distance <75 && distance >1)
{
analogWrite(motorPin,255);
** delay(50);**
** analogWrite(motorPin,0);**
** delay(100);** repeated for 4 times

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(100);

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(100);

analogWrite(motorPin,255);
delay(50);

analogWrite(motorPin,0);
delay(100);

analogWrite(motorPin,255);
delay(50);
analogWrite(motorPin,0);
delay(100);

}
}
meanwhile…the output analog distance values in the serial monitor is not being shown…what do i infer from this?

int duration = pulseIn(echoPin, HIGH);//datatype for duration suggest please...int datatype is well and working

That question has already been answered in your other thread on this subject.

the bold code in every if else statement is to be looped for different times.so is there any better way to do so the bold code in every if else statement is to be looped for different times.so is there any better way to do so

Yes, use a function

When posting code, please use CODE TAGS