Ultrasonic HC-SR04 Activate Relay

Hi Guys, Need you help on solving a small issue i have… for now i manage to a HC-SR04 to on and off a relay.
What i want for my arduino to do is to on the relay when it measures a distance of 60-80cm. anything less the relay should be off. anything more the relay should be off as well.

"
#define echopin 9 // echo pin

#define trigpin 8 // Trigger pin

int maximumRange = 50;

long duration, distance;

void setup() {

Serial.begin (9600);

pinMode (trigpin, OUTPUT);

pinMode (echopin, INPUT );

pinMode (4, OUTPUT);

pinMode (13,OUTPUT);

}

void loop ()

{

{

digitalWrite(trigpin,LOW);

delayMicroseconds(2);

digitalWrite(trigpin,HIGH);

delayMicroseconds(10);

duration=pulseIn (echopin,HIGH);

distance= duration/58.2;

delay (50);

Serial.println(distance);

}

if (distance >= 25 ){

digitalWrite (13,HIGH);

}

else if (distance <=10) {

digitalWrite (13,LOW);

}

}
"

This was a code given to me by ibenkos… but and having difficulty to perform my programming… no errors but my relays keeps on active…

const int echopin = 9; // echo pin
const int trigpin = 8; // Trigger pin

const int maximumRange = 100;  // Maximum measured range in CM

long duration;
int distanceCM;

void setup() {
  Serial.begin (9600);
  pinMode (trigpin, OUTPUT);
  digitalWrite(trigpin,LOW);
  pinMode (echopin, INPUT );
  // pinMode (4, OUTPUT);
  pinMode (13,OUTPUT);
}

void loop() {
  digitalWrite(trigpin, HIGH);
  delayMicroseconds(2);
  digitalWrite(trigpin, LOW);
  delayMicroseconds(10);
  duration = pulseIn (echopin, HIGH, maximumRange*60);

  distanceCM = duration/58.2;
  delay (50);
  Serial.println(distanceCM);

  // Turn on the output iff distance 60 to 80 cm inclusive.
  digitalWrite(13, distanceCM >= 60 && distanceCM <= 80);
}

Hi John...

Thank you... will try out the code and will update you if the circuit is running...

Devan