int PWen = 13;int SWin = 2;int SWout = 4;long Tin=0;long Tout=0; long T1=0;
long T2=0; int Nop=0;long in=0;long out=0;

void setup() 
{
pinMode(PWen, OUTPUT);pinMode(SWin, INPUT);pinMode(SWout, INPUT);
Serial.begin(9600);
T1=millis();
}
void loop() 
{
  if(digitalRead(SWin))  Nop++;
  while(digitalRead(SWin))
{
  in++;
    Tin=millis();
    Tin++;
}
// ---------------------------------------------------
if(digitalRead(SWout))  Nop--;
  while(digitalRead(SWout))
{
  out++;
    Tout=millis();
    Tin++;
}
if(Nop<0) Nop=0;
Serial.print("No. of Person on room = ");
Serial.println(Nop);
delay(500);
Serial.println("------------------------------------");

if(Nop>0)
    digitalWrite(PWen,HIGH);
 else
 {
  Serial.print("No. of Person on room = "); // temporary solution
  Serial.println(Nop);                      // temporary solution
  delay(5000);                              // temporary solution
       digitalWrite(PWen,LOW); 
 }

 }