Lcd isnt printing

The lcd (JHD162A) is not printing in the if loop condition or anywhere else in my program. The lcd is working perfectly fine tho and is does print the simple program but not in this one so that eliminates the case of the circuit or lcd not working . The code is as follows

#include <HCSR04.h>
#include <LiquidCrystal.h>
long duration;
int distance;
LiquidCrystal lcd(0, 1, 8, 9, 10, 11);
const int trigPin = 6;
const int echoPin = 7; 
int buzzerPin = 2;
void setup()
 pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
 pinMode(echoPin, INPUT); // Sets the echoPin as an Input
 pinMode(buzzerPin, OUTPUT);
 Serial.begin(9600); // Starts the serial communication 
void loop()

digitalWrite(trigPin, LOW);
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2)/29;
Serial.println("Distance is: ");


if( distance <= 10)
  lcd.print("Pls move away");
  digitalWrite(buzzerPin, HIGH);
  tone(buzzerPin, 1000, 500);
  lcd.print("Hello world");


when the if condition is satisfied the buzzer does buzz but the lcd prints either fff or ddd

Don't use pins 0 & 1 for the LCD; they are also used by the Serial h/w on most Arduino boards.

--- bill

Don't use lcd.clear(); in a loop which may be called repeatedly.

... Instead make both (all) of your messages the same length, padding with spaces if necessary. Then each message will overwrite the previous one eliminating the need to first clear the screen.