int i;
unsigned seg_display[] = {0xc0, 0xf9, 0xa4, 0xb0,  0x99,0x92, 0x82, 0xf8, 0x80, 0x90};  //setup array for 7 seg display with hex values 0 to 9

void main()
{
TRISC =1; //Setup for Inputs
TRISB= 0; //Setup for Outputs
PORTB= 1; //int high to clr common annode display
PORTC= 0; //int low to wait for inputs

       do
       {
            if(PORTC.f1 ==1) // if switch is on
             {
             for (i=1;i<=9;i++) //start at 1 then if i is less than 10 add 1
                 {
                 PORTB = seg_display[i]; //display i on 7 seg display
                 delay_ms(500); //pause 500ms changed from 100ms to be easier to read
                 }
             }
             PORTB = 0xff;  //switch display off


             if(PORTC.f2 ==1) //if switch two is on
             {
               for (i=9;i>=1;i--) //start at 8 then if i is more/= than 1 sub 1
                 {
                  PORTB = seg_display[i]; //display i on 7 seg display
                  delay_ms(500); //pause 500ms changed from 100ms to be easier to read
                  }
              }

            PORTB = 0xff;  //switch display off
        }
  while(1); //loop infinitely
}
