temperature sensor project

Was about to post that the code is for a TMP36 (not LM35), but I saw GolamMostafa already did.
You get a 50 degrees C offset when you use TMP36 code for an LM35 (-28.52 + 50 = 21.48)

This is the most simple LM35 maths line to convert to tempC with a 10-bit A/D and 1.1volt Aref enabled:
(analogRead(A0) * 0.1039)

Sketch for both types of sensors attached (set for LM35).
It can be further improved with averaging/smoothing code.
Leo..

// LM35_TMP36 temp
// connect LM35 to 5volt A0 and ground
// connect TPM36 to 3.3volt A0 and ground
// calibrate temp by changing the last digit(s) of "0.1039"

float tempC; // Celcius
float tempF; // Fahrenheit

void setup() {
  analogReference(INTERNAL); // use internal 1.1volt Aref
  Serial.begin(9600);
}

void loop() {
  tempC = ((analogRead(A0) * 0.1039)); // uncomment this line for an LM35
  //tempC = ((analogRead(A0) * 0.1039) - 50.0); // uncomment this line for a TMP36
  tempF = tempC * 1.8 + 32.0; // C to F
  Serial.print("Temperature is  ");
  Serial.print(tempC, 1); // one decimal place
  Serial.print(" Celcius  ");
  Serial.print(tempF, 1);
  Serial.println(" Fahrenheit");

  delay(1000); // use a non-blocking delay when combined with other code
}