limit temperature and humidty DHT11 arduino

I intend to set limits on the temperature and humidity Arduino and dht11
I set limits temperature between 20-27 and humidity between 35-60

but when I try, the program does not work
I read on the device temp: 23 and humidity: 40
but are visible only "temperature under 20c ", which should be seen temp: 23 and humidity: 40

why like this? is there an error on my coding

this my code

#include <dht11.h>
#define dht_pin 2 


int DHT_max = 27 ;
int DHT_min = 19 ;
int DHT_maxhum = 60 ;
int DHT_minhum = 35 ;
dht11 DHT;


void setup()
{
  
void temp(){

  Serial.print("| humidity = ");
  Serial.print(DHT.humidity);
  Serial.print("% | ");
  Serial.print("temp = ");
  Serial.print(DHT.temperature);
  Serial.println("C ");
}

void loop()
{
    DHT.read(dht_pin);

  
  if (DHT.temperature >= DHT_max)
    {
    Serial.println ("temperature over 27C");
    }
    else if (DHT.humidity>= DHT_min)
    {
    Serial.println ("temperature under 20C");
    }
     else if (DHT.humidity>= DHT_maxhum)
    {
    Serial.println ("humidity over 60C");
    }
    else if (DHT.humidity>= DHT_minhum)
    {
    Serial.println ("humidity under 35C");
    }

  else
    {
 temp();
    }

  delay(2000);
    }

please help me....

You need to break up your if statements. As it is, only one of them will execute. In this case, it is the second one:

 else if (DHT.humidity>= DHT_min)
    {
    Serial.println ("temperature under 20C");
    }

That can't be right.

You want one for humidity and another set for temperature.

tbradt:
You need to break up your if statements. As it is, only one of them will execute. In this case, it is the second one:

 else if (DHT.humidity>= DHT_min)

{
    Serial.println ("temperature under 20C");
    }




That can't be right.

You want one for humidity and another set for temperature.

i change dht.humidity with dht.temperature, device read temp: 23 and humidity: 40 but in the serial monitor the result is same "temperature under 20C

i change dht.humidity with dht.temperature, device read temp: 23 and humidity: 40 but in the serial monitor the result is same "temperature under 20C

When you change code, you need to repost it. Using Tools + Auto Format to fix your crappy indenting first would be appreciated. It might even allow you to see the problem.