[Solved]If and high-low code problem

I'm measuring the sunlight and my LCD screen is supposed to on when it is bright and off when it is dark.With this code I have no problem measuring light.LCD is on when it is bright but when I darken my LDR, LCD does not turn off, it stays on.Am i missing something here?

double Light (int RawADC0)
{
  double Vout=RawADC0*0.0048828125;
  double lux=(2500/Vout-500)/10;
  return lux;
}


void setup()
{
  pinMode(A3, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  Serial.println(int(Light(analogRead(0))));
  delay(1000);
  if ( analogRead(0) > 15)
  {
     digitalWrite(A3, HIGH);
  }
  else
  {
    digitalWrite(A3, LOW);
  }
}

Put the value from analogRead(0); in a variable and use it instead of reading it twice. Try printing the value. What do you see ?

15 seems a very low value at which to switch the LCD on/off but we don't know anything about your setup.

In the sunlight I get values around 40 by reading serial port. I defined analogRead as variable but it didn't work.

40 from what?

40 from:
Serial.println(int(Light(analogRead(0))));

or 40 from:

Serial.println(analogRead(0));

If your LDR is reading (from analogRead(), assuming the typical connections) <15 in darkness and 40 in sunlight the resistor in series with it is probably the wrong value, or something else is wrong. How is it wired?


Imgur
-Resistor is 10k. I read <4 when it is dark. 15 is threshold value that I chose.If I'm not mistaken 40 is from Serial.println(int(Light(analogRead(0))));.
Change of values in serial port is matching according to light intensity, I think there is no problem with that.

-Right now I use LED instead of LCD screen seen in picture for easier test.

Personally, I don't think it makes any sense to print the value returned by the function when that is NOT the value used in the rest of the code. Print what you ACTUALLY use.

Thank you for your answers, I understand finally, I printed wrong values and now it works fine.Thank you again.