Temperature control using relay.

your code is quite confusing. Try cutting it down by using functions? Your void loop could look something like this:

void loop(){
readSensor();
runFan();
if (temp>28){
runCooler();
}