Taking input from push buttons
I don't know the Arduino language but I've recently been learning, from what I can gather on the website unsigned ints will "roll-back" to zero if they reach their maximum (which will be reached in a huge "fifty days" so no need to worry about that.

You can clean up your syntax for your statements by putting the braces at the end  of the statement (on the same line), also remove the byte i from the function visibility into only the loop by declaring it in the for.

I also noticed that your function checkswitch is only used for boolean operations yet it's returning a byte - this can be fixed by returning the result of the comparison of the if you used directly.

Here is my suggestion:

byte key=0;
unsigned int st=millis(),ct=millis(); //st-starttime , ct-currenttime

void setup() {
  delay(5000);            //start prog after 5 sec
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  for(byte i=7;i&lt;=9;i++)
    digitalWrite(i, HIGH);    //7,8,9 pins HIGH  for internal pullup
  Serial.begin(9600);
}

void loop() {
  for(byte i=7;i&lt;=9;i++)
    if(isHigh(i)) {      //check which switch was last pressed  
      key=i;
      st=millis();
    }

  if(ct&gt;st+200) {                 //triggers only if 200 ms passed to not fill the Serial input
    if(key!=0) {
      Serial.println(key);
      key=0;                       //clear saved key
    }
  }
}

boolean isHigh(byte n) {          //Check button pressed with internal pullup
    return digitalRead(n)==LOW;
}