Problem - arduino board/pushbutton action

Hi!I have a problem with my pushbutton.When i do the circuit and the code and then when i plug in the arduino and upload the code and when i push the button it turns off the arduino board and when i take the finger the arduino board turns on.Can you please help me? Below is the code and the circuit diagram:

const int buttonPin = 2;   
const int ledPin =  13;      
int buttonState = 0;         
void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(buttonPin, INPUT);     
}

void loop(){

  buttonState = digitalRead(buttonPin);


  if (buttonState == HIGH) {     
   
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    
    digitalWrite(ledPin, LOW); 
  }
}

Can you please say me what's the problem? I've also changed the pushbutton and it does the same thing. Is my arduino uno r3 damaged?

Are you sure you have that resistor?- without it, you get a dead short from 5V to GND and zap......

yeah,i'm sure.i have a 10 k resistor

Might be an idea to double check its markings; better yet measure it with your ohm-meter.

brown-black-orange

edit.... also maybe post a pic of your actual circuit, not the way it should be from the site example.

http://arduino.cc/en/Tutorial/Button

Try this instead - get rid of all wires. Connect one side of the button to pin 2, connect the other side to Gnd. Modify the code a little to use the internal pullup resistor, and look for at LOW to act on:

const int buttonPin = 2;   
const int ledPin =  13;      
int buttonState = 0;         
void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(buttonPin, INPUT_PULLUP);   // change 1   
}

void loop(){

  buttonState = digitalRead(buttonPin);


  if (buttonState == LOW) {     // change 2
   
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    
    digitalWrite(ledPin, LOW); 
  }
}

The attached pic shows the connections for internal pullup, external pullup, external pulldown.