I can't stop the Buzzer's sound at a distance of 30cm or more. Help me.

I can not stop the sound of the Buzzer at a specified distance (30cm). please help me with it?

//#include <LiquidCrystal.h>
#include <Servo.h>

//LiqiuidCrystal lcd(12, 11, 5, 4, 3, 2);

Servo servo;
int trig=9;
int echo=8;
int duration;
float distance;
float meter;
int buzzer=11;
void setup()
{
//lcd.bengin(16,2);
//lcd.print("Svolt solution ");
Serial.begin(9600);
servo.attach(6);
pinMode(trig, OUTPUT);
digitalWrite(trig, LOW);
delayMicroseconds(2);
pinMode(echo, INPUT);
delay(6000);
pinMode(buzzer, OUTPUT);
Serial.println("Diatance:");
}

void loop()
{
int i=20;
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance = duration/58;
Serial.print(distance);
Serial.print("cm");
Serial.print("\n");
noTone(buzzer);

if(distance<=30 && distance >=1)
{
i=distance*i;
digitalWrite(buzzer, HIGH);
delay(i);
digitalWrite(buzzer, LOW);
delay(i);
}
delay (10);
}

I can not stop the sound of the Buzzer at a specified distance (30cm).

since distance is a float, are you sure distance is <= 30.0000?

Perhaps the "noTone(buzzer);" is a problem. Especially if tone() and Servo.h use the same timer.