need help please i newbie here

where the problem, i dont understand this error

#define trigPin2 7
#define echoPin2 6
#define trigPin 5
#define echoPin 4
#define buzzer 2
#define led 8
#define led2 9

long duration, duration3, distance;

#include<Servo.h> Servo myservo;

void setup() {

Serial.begin(9600);
}

pinMode(trigPin2,OUTPUT); pinMode(echoPin2,INPUT); pinMode(led,OUTPUT); pinMode(led2,OUTPUT); pinMode(buzzer,OUTPUT); pinMode(trigPin,OUTPUT); pinMode(echoPin,INPUT); myservo.attach(3);

void loop()

{

long duration2,distance2;

digitalWrite(trigPin,LOW); delayMicroseconds(2); digitalWrite(trigPin,HIGH); delayMicroseconds(10); digitalWrite(trigPin,LOW); duration2 = pulseIn(echoPin,HIGH);

distance2 = (duration2) / 29 / 2;

if(distance2 > 10)
{
penclose();
}
lighting();
}

void openclose()

{

long duration, inches, cm;

digitalWrite(trigPin2,LOW); delayMicroseconds(2); digitalWrite(trigPin2,HIGH); delayMicroseconds(10); digitalWrite(trigPin2,LOW);

duration = pulseIn(echoPin2,HIGH);

cm = duration / 29 / 2;

if(cm < 10)
{
myservo.write(90); delay(150);
}
else
{
myservo.write(0);
}
delay(1000);
}
void lighting()

{

digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10);

duration3 = pulseIn(echoPin, HIGH);

distance = duration3/29.2; Serial.println(distance);
if (distance < 1){ digitalWrite(led, HIGH); digitalWrite(led2, HIGH); digitalWrite(buzzer,LOW);
}
else if (distance < 7){ digitalWrite(buzzer,HIGH); digitalWrite(led, HIGH); digitalWrite(led2,HIGH);
}
else if (distance < 15){ digitalWrite(led, HIGH); digitalWrite(led2,HIGH); digitalWrite(buzzer, LOW);
}
else if (distance < 20){ digitalWrite(led, HIGH); digitalWrite(led2,LOW); digitalWrite(buzzer, LOW);

}
else if (distance > 20){ digitalWrite(led, LOW); digitalWrite(led2, LOW); digitalWrite(buzzer, LOW);
}
delay(50);
}

Hello - if you see an error , you should show it!
Furthermore, you belong to the hundreds of beginners who do not read the posts in the beginning.A program should be set with the tags </>.
Another hint: do not write more then one instruction in a line. Your program ist terrible to read.

Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum, specifically pint #7 about posting code. Next edit your post and add the code tags.

Next learn to use tools->autoformat in the IDE; it will sort out your indentations and you can probably see what goes wrong.

Function calls can not be outside functions so the pinMode statements need to go inside the setup(). The fact that your pinMode() starts at the beginning of a line after an autoformat indicates this error

#includes need to be on their own line.

The function penclose() does not exist; you probably meant to call openclose().

if(distance2 > 10)
{
penclose();
}
lighting();
} <<< loop function ends here.