Temperature and humidity detection using DHT22 and when the temperature exceeds the stated threshold GSM SIM900 should send SMS, but code not working

#include <DHT.h>  //DHT header
#define dataPin 2 //input pin
#define DHTType DHT22 //DHT model 
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8
DHT dht = DHT(dataPin, DHTType);
/*
 * the setup function will start by initializing the serial monitor using the baud rate of 9600
 * this will allow us to utilize a serial monitor to read data back from the Arduino.
 */

void setup() {
    Serial.begin(9600);
    dht.begin();
}

void loop() {
    delay(2000);
    float h = dht.readHumidity();

    float t = dht.readTemperature();

    if (isnan(h) || isnan(t)) {
        Serial.println("Failed to read from the DHT sensor, check wiring.");
        return;
   }
    
    Serial.print("Humidity: ");
    Serial.print(h);
    //Print out the Temperature
    Serial.print("% || Temperature: ");
    Serial.print(t);
    Serial.print("°C ");

    //Print new line
    Serial.println();
    


if (t>30 || h>90){
String number = "+260975536338";
String sms = "ALERT FROM STORE HOUSE!!!:\n HIGH TEMPERATURE IN THE ROOM PUT REGULATION MEASURES.";

void setupn()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);

  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);

  Serial.println("Initializing...");
  delay(1000);

  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();
  sendMessage(sms,number);
}

void loops()
{
 
}

void sendMessage(String sms, String number) {
  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CMGS=\"" + number + "\"");//number to sms
  updateSerial();
  mySerial.print(sms); //text content
  updateSerial();
  mySerial.write(26); //escape 'character' code to end messaging process
}

void updateSerial(){
  delay(500);
  while (Serial.available())
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while (mySerial.available())
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}
}

    }
    

Thank you for using the code tags.

As far as I see, the correct say should be "code not compiling" rather than "... not working"

Please do not put all your message to the title. If you looking for help - please explain your problem in more detail way.

Hello nicklungu

The sketch does not compile.
First check the arrangement of the curly brackets.

In function 'void loop()':
sketch_feb11b:46:5: error: a function-definition is not allowed here before '{' token
     {
     ^
sketch_feb11b:62:5: error: a function-definition is not allowed here before '{' token
     {
     ^
sketch_feb11b:66:49: error: a function-definition is not allowed here before '{' token
     void sendMessage(String sms, String number) {
                                                 ^
sketch_feb11b:76:25: error: a function-definition is not allowed here before '{' token
     void updateSerial() {
                         ^