Why doesn't pin 9 blink? I use simple LED blinking code on an Arduino MEGA 2560. I simulate it in Proteus. But pin number 9 doesn't power up. What is the problem?

My code:

// Set up the DATA direction
void setup()
{
  for(int i = 1; i&lt;9; i++)
    pinMode (i, OUTPUT);
}

// The main program
void loop()
{
  for(int j=2; j&lt;=10; j++)
  {
    digitalWrite(j, HIGH);
    delay(100);
    digitalWrite(j, LOW);
  }

  for(int j=9; j&gt;=2; j--)
  {
    digitalWrite(j, HIGH);
    delay(100);
    digitalWrite(j, LOW);
  }
}


And the circuit is:
It looks like your main problem is the loop in setup():

for(int i = 1; i&lt;9; i++)
    pinMode (i, OUTPUT);


This will call pinMode() with values 1 to 8 (inclusive), and then stop. That means you aren't configuring pin 9 as an output. You need to change the loop condition to i&lt;=9.

However, if your circuit diagram is accurate then you will have another problem. When implementing the circuit for real, you absolutely must have a suitable resistor in series with each LED (maybe something around 200 Ohms, depending on the exact specifications). If not, you seriously risk destroying the LEDs and maybe damaging your Arduino.