7 bit display countdown activation

Hello. I am fairly new at Arduino and coding in general. My project is an alarm system that when, a button is pressed, begins a countdown on a 7 bit display and when the countdown gets to 0, a very annoying sound blares from the active buzzer. My current code is below this small paragraph and i have marked up a diagram of the 7 bit display in the attachments (i cant be bothered with diagraming it all myself).(btw the box with the red circle in it is the buttons and the black circle with the gray circle inside it is the buzzer). The problem is that once i press the button, the countdown gets stuck at 9 and does not go any further.
thanks

CODE:

int buzzer = 12;//the pin of the active buzzer
byte seven_seg_digits[10] = { B11111100,  // = 0
                         B01100000,  // = 1
                         B11011010,  // = 2
                         B11110010,  // = 3
                         B01100110,  // = 4
                         B10110110,  // = 5
                         B10111110,  // = 6
                         B11100000,  // = 7
                         B11111110,  // = 8
                         B11100110   // = 9
                        };


int latchPin = 3;

int clockPin = 4;

int dataPin = 2;

int button = 9;

void setup() {
// Set latchPin, clockPin, dataPin as output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(button, INPUT_PULLUP);
}


void sevenSegWrite(byte digit) {

digitalWrite(latchPin, LOW);


shiftOut(dataPin, clockPin, LSBFIRST, seven_seg_digits[digit]);  


digitalWrite(latchPin, HIGH);
}

 
void loop() {
if (digitalRead(button) == LOW){
for (byte digit = 10; digit > 0; -- digit) {
delay(1000);
sevenSegWrite(digit - 1); 
unsigned char i;
while(1)

if (digit==0){
digitalWrite(buzzer,HIGH);
delay(1);//wait for 1ms
digitalWrite(buzzer,LOW);
delay(1);//wait for 1ms

delay(100);
}

}
}



}

Please reply with a solution

Please read the sticky posts above, particularly "How to use this forum - please read.".

Your code is very difficult to read, it needs to be in code tags. Also, you never said what is not working.

Aha thanks

If you auto format your code (Ctrl-T) you will see that you while(1) loop will loop forever since the first time into the loop, digit = 10 so this code

      while (1)
        if (digit == 0) {
          digitalWrite(buzzer, HIGH);
          delay(1);//wait for 1ms
          digitalWrite(buzzer, LOW);
          delay(1);//wait for 1ms
          delay(100);
        }

evaluates to

      while (1)
        continue

which is an endless loop

void loop() {
  if (digitalRead(button) == LOW)
  {
    for (byte digit = 10; digit > 0; -- digit)
    {
      delay(1000);
      sevenSegWrite(digit - 1);
    }


    while (digitalRead(button))  // Until the button is pressed
    {
      // Make an awful noise
      digitalWrite(buzzer, HIGH);
      delay(1);//wait for 1ms
      digitalWrite(buzzer, LOW);
      delay(1);//wait for 1ms
    }
  }
}

thank you both. Both codes worked.