Using dht22 and DFRobot Gravity: Analog Infrared CO2 Sensor(arduino uno rev 2)

struggling with integrating the dht22 sensor in the same code with the co2 sensor and vise versa. The code separately will both compile but when i try to mesh them together I get error messages. Please help :).

Code for the sensors meshed together

#include <SPI.h>
#include <DHT.h>;
#include <DHT_U.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>
//Constants
int sensorIn = A4;
#define DHTPIN 2     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino


//Variables
int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

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

void loop()
{
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(2000); //Delay 2 sec.
}
 int sensorValue = analogRead(sensorIn);
  // The analog signal is converted to a voltage
  float voltage = sensorValue*(5000/1024.0);
if(voltage == 0)
  {
    Serial.println("Fault");
  }
  else if(voltage < 400)
  {
    Serial.println("preheating");
  }
  else
  {
    int voltage_diference=voltage-400;
    float concentration=voltage_diference*50.0/16.0;
    // Print Voltage
    Serial.print("voltage: ");
    Serial.print(voltage);
    Serial.println("mv");
    //Print CO2 concentration
    Serial.print("CO2 Concentration: ");
    Serial.print(concentration);
    Serial.println("ppm");
  }
}

error message for code above

sketch_jan02b:55:1: error: expected unqualified-id before 'if'
 if(voltage == 0)
 ^~
sketch_jan02b:59:3: error: expected unqualified-id before 'else'
   else if(voltage < 400)
   ^~~~
sketch_jan02b:63:3: error: expected unqualified-id before 'else'
   else
   ^~~~
sketch_jan02b:76:1: error: expected declaration before '}' token
 }
 ^
exit status 1
expected unqualified-id before 'if'

DHT22

//Libraries
#include <SPI.h>
#include <DHT.h>;
#include <DHT_U.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>
//Constants
#define DHTPIN 2     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino


//Variables
int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

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

void loop()
{
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(2000); //Delay 2 sec.
}

Co2 sensor

int sensorIn = A4;
#include <SPI.h>
#include <Adafruit_GFX.h>

void setup(){
  Serial.begin(9600);
  // Set the default voltage of the reference voltage
  analogReference(DEFAULT);
}
void loop(){
  //Read voltage
  int sensorValue = analogRead(sensorIn);
  // The analog signal is converted to a voltage
  float voltage = sensorValue*(5000/1024.0);
 if(voltage == 0)
  {
    Serial.println("Fault");
  }
  else if(voltage < 400)
  {
    Serial.println("preheating");
  }
  else
  {
    int voltage_diference=voltage-400;
    float concentration=voltage_diference*50.0/16.0;
    // Print Voltage
    Serial.print("voltage: ");
    Serial.print(voltage);
    Serial.println("mv");
    //Print CO2 concentration
    Serial.print("CO2 Concentration: ");
    Serial.print(concentration);
    Serial.println("ppm");
  }
}

The loop() code is short

void loop()
{
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(2000); //Delay 2 sec.
}

Anything after the } needs to be in a function definition - or the } needs to be farther down in the code.

are you referring to the dht22 code as that code will compile- I am having problems with the first set of code that will not compile- the other two pieces will compile. if you are referring to the first bit of code is the solution I just turn all } into { or remove them until the end of the code. Thank you