KY-013 Temperature sensor working incorrectly

Hello, recently I've bought the analog temperature sensor KY-013 and then I connected it to my Arduino
and used this code:

void loop() {
  
  double val = analogRead(A0);
  double temp = Thermistor(val);
  Serial.println(temp);
  
}

double Thermistor(double RawADC) {
  double Temp;
  Temp = log(10000.0*((1024.0/RawADC-1))); 
  Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
  Temp = Temp - 273.15;            // Convert Kelvin to Celcius
  return Temp;
}

first, it showed 22 c which makes sense but then I warmed the sensor and the temperature dropped on the serial monitor.
Does somebody know why it is flipped?

Did you swap the +5volt and ground pins?
Leo..

Wawa:
Did you swap the +5volt and ground pins?
Leo..

I don't think so, and if I did wouldn't it burn the sensor?

dindibo4:
...and if I did wouldn't it burn the sensor?

There are only two resistors on that board (non-polarised parts).
A fixed one (10k) and a variable one (10k thermistor).
They make a voltage divider, with the tap connected to the analogue input.
Maybe the thermistor is connected to ground and the resistor to +5volt.
The code seems to expect the resistor to ground.
Try swapping the +5volt and ground wires.
Leo..

Wawa:
There are only two resistors on that board (non-polarised parts).
A fixed one (10k) and a variable one (10k thermistor).
They make a voltage divider, with the tap connected to the analogue input.
Maybe the thermistor is connected to ground and the resistor to +5volt.
The code seems to expect the resistor to ground.
Try swapping the +5volt and ground wires.
Leo..

Hey Leo, Thank you for your advise I did as you said and the problem has been solved!
it works great.
Thanks for the help