int a = 8; int b = 7;
int c = 6; int d = 5;
int e = 4; int f = 3;
int g = 2; int dp = 1;

int seg[] = {a, b, c, d, e, f, g, dp};

void off(){
  for (int i = 0; i < 8; i++) {
    digitalWrite(seg[i], HIGH);
  }
  delay(1000);
}

void point() {
  off();
  digitalWrite(dp, LOW);
  delay(1000);
  off();
}

void num_0(){
  off();
  for (int i = 0; i < 7; i++) {
    digitalWrite(seg[i], LOW);
  }
  digitalWrite(g, HIGH);
  delay(1000);
  off();
}


void num_1(){
  off();
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  delay(1000);
  off();
}

void num_2(){
  off();
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(g, LOW);
  delay(1000);
  off();
}

void num_5(){
  off();
  digitalWrite(a, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  delay(1000);
  off();
}

void num_9(){
  off();
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  delay(1000);
  off();
}

void setup() {
  for (int i = 0; i < 8; i++) {
    pinMode(seg[i], OUTPUT);
  }
}

void loop() {
  num_2(); num_2();
  point();
  num_1(); num_1();
  point();
  num_5(); num_2();
  num_0(); num_9();
}