help please... temperature sensor nearly finished

i am doing a project for my uni, i am making a temperature sensor using the arduino uno r3 board…

I have got a temperature sensor LM35, TO-92 (casing), when i use it on terminal I get the following result, 143, when i put my hand it reaches like 160, but what is this? how do i turn it to celcius? please help my code is:

int val1 = 0;
int count = 0;
float tempC;
int tempPin = 0;
void setup(){
Serial.begin(19200); //initializes serial port with a baudrate of 19200bps (same as XBee chip)
}

// function to send data

void sendData(int id,int num, int data1){

Serial.print("@");
Serial.print(id);
Serial.print("|");

Serial.print(num);

Serial.print("|data1-");
Serial.print(data1);

Serial.println("#r"); // end of message

}

void loop(){

tempC = analogRead(tempPin); //read the value from the sensor
tempC = (5.0 * tempC * 100.0)/1024.0; //convert the analog data to temperature
Serial.print((byte)tempC);

while (count <= 10000){

val1 = analogRead(sens1);

sendData(3,count, val1);

delay(5000);
count++;
}

count = 0;

}

The first analog read in your loop does the conversion(tempC = 5.0*tepC..), but you then have a while loop later in your loop and that one doesn't go through the conversion on each analog read as it prints out the value.(just sends the analog value straight to the send function)

also, please use code bracket things etc.

 float tempC;

tempC = analogRead(tempPin);           //read the value from the sensor
tempC = (5.0 * tempC * 100.0)/1024.0;  //convert the analog data to temperature

analogRead() return an interger. Not a float.

do this :

tempC = float( analogRead( tempPin ) );

Try that.

please use the # button when posting code, it provides [ code] tags so the code looks better.
Also use the CTRL-T in the IDE to do an auto layout

here a refactor of your code

int val1 = 0;
int count = 0;
float tempC = 0;
int tempPin = 0;

void setup()
{ 
  Serial.begin(19200);    // initializes serial port same as XBee chip
}

void sendData(int id, int num, int data1)
{
  Serial.print("@");
  Serial.print(id);
  Serial.print("|");
  Serial.print(num);
  Serial.print("|data1-");
  Serial.print(data1);
  Serial.println("#r");      // end of message
}

void loop()
{
  tempC = analogRead(tempPin);               //read the value from the sensor
  tempC = (5.0 * tempC * 100.0)/1024.0;   //convert the analog data to temperature
  
  sendData(3, count, tempC);
  delay(5000);
  
  count++;
  if (count == 10000) count = 0;
}

I don't know why you've got all that stuff about printing results every five seconds; if I were you, I'd have a dead simple test sketch getting and printing the temperature continuously to the serial monitor.
Once you've fixed that, then add all the other junk.

const int tempPin = 0;

void setup()
{ 
  Serial.begin(19200);
}

void loop()
{
  Serial.println (readTemp (tempPin), 1); 
  // Optional delay of say 100 milliseconds.
}

float readTemp (const int sensorPin)
{
  float tempC = analogRead(sensorPin);               //read the value from the sensor
  // Serial.println (tempC, 0);  // optional print of the raw value
  return (5.0 * tempC * 100.0)/1024.0;   //convert the analog data to temperature
}