Combining Codes

heres my code if you wanna try

const uint8_t RedLed= 9;
const uint8_t GreenLed= 10;
const uint8_t BlueLed= 11;
const uint8_t PhotoSensor= A0;
const uint8_t SetValue=300;

void setup()
{
 pinMode(RedLed,OUTPUT);
 pinMode(GreenLed,OUTPUT);
 pinMode(BlueLed,OUTPUT);
}

void loop()
{
  if (analogRead(PhotoSensor)>SetValue)
  {
    for(int a=0;a<=255;a++)
    {
     for(int b=0;b<=255;b++)
     {
      for(int c=0;c<=255;c++)
      {
        analogWrite(RedLed,a);
        analogWrite(GreenLed,b);
        analogWrite(BlueLed,c);
      }
     }
    }
     for(int a=255;a>=0;a--)
    {
     for(int b=255;b>=0;b--)
     {
      for(int c=255;c>=0;c--)
      {
        analogWrite(RedLed,a);
        analogWrite(GreenLed,b);
        analogWrite(BlueLed,c);
      }
     }
    }
  }
  else
  {
   digitalWrite(RedLed,LOW);
   digitalWrite(GreenLed,LOW);
   digitalWrite(BlueLed,LOW);
  }
}