2 LED 2 Buttons

I am trying to make a simple circuit with an Arduino UNO, 2 LEDs and 2 buttons. I want to turn on circuit and have green LED on, push red button and have green LED go off and red LED come on, push red button and have red LED go off and green button come on.

green button ground and Pin 3
red button ground and Pin 2
green LED Pin 13 and ground
red LED ground and +resistor Pin 11

Both LEDs on
push green button both LED off. push again nothing.
both LEDs on, push red button,both LEDs blink, several pushes both go off,
both LEDs off, push red button, LEDs blink, several pushes both LEDs come on.

Cans anyone help?

Thanks

 //2 led 2 button
int redbuttonPIN = 2;    //red button
int greenbuttonPIN = 3;  //green button
int redledPIN = 11;      //red led
int greenledPIN = 13;    //green led
int state = HIGH;        //current state of output pin
int reading;             //current reading from the input pin
int reading2;         
int previous = LOW;      //previous reading from the input pin

// following variables are long because time in milli sec
long time = 0;              //last time the output pin was toggled
long debounce = 200;   // debounce time increases if output flickers

void setup() {
  pinMode(redbuttonPIN, INPUT);     //red button is an input
  pinMode(redledPIN, OUTPUT);       //red led is output
  pinMode(greenbuttonPIN, INPUT);   //green button in input
  pinMode(greenledPIN, OUTPUT);     //green led is output

  pinMode(redbuttonPIN, INPUT);
  digitalWrite(redbuttonPIN, HIGH);   //enable pull resistor

  pinMode(greenbuttonPIN, INPUT);
  digitalWrite(greenbuttonPIN, HIGH);  //enable pull resistor
}

void loop() {
  reading = digitalRead(redbuttonPIN);  //reading red button
  reading2 = digitalRead(greenbuttonPIN);  //reading green button

  //if the input went from low to high
  //ignore noise from circuit, toggle the output pin and remember
  //time
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    if (state = HIGH)
      state = LOW;
    else
      state = HIGH;

    time = millis();
  }

  digitalWrite(redledPIN, state);  //chaging redled pin to on or off

  previous = reading;
  if (reading2 == HIGH && previous == LOW && millis() - time > debounce){
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;

   time = millis();
  }
  digitalWrite(greenledPIN, state);  //changing ledg pin state to on or off

  previous = reading2;
}

Before looking at the code, let's get this sorted out:

gfvesley:
green LED Pin 13 and ground

If by that you mean an external LED over and above the built-in one, it also needs a resistor, just like your red one on pin 11.

Doesn't pin 13 have a 1K resistor built in? The green LED in on and has not burned out.

gfvesley:
Doesn't pin 13 have a 1K resistor built in?

If you look top-centre of the Uno R3 schematic, you will see there's a resistor in series with the built-in LED but that won't help an external LED.

varesano.net - and-arduino-based-gamepad-int page 5/17 "...pin 13 has a 1k resistor connected in serries, so it is safe to directly connect the LED to it." among other references. The addition of a 1k resistor to the +side of LED and pin 13 reduces the intensity of the LED, but does not affect the operation of the circuit.

For reasons best known to himself, one Paul__RB oops sorry I mean Paul__B has taken this into a PM chain, so in the interests of clarity here's his main point:

No board since the Arduino Diecimila has had a resistor in series with pin 13. Earlier boards did, and in fact this was a design fault that rendered the pin unusable

I take that to mean I'm right in what I said about the Uno R3, where the resistor protects only the built-in led. Here's a snip from the Uno R3 schematic.

LesserMole:
For reasons best known to himself, one Paul__RB has taken this into a PM chain

Huh???

Ooops typo there, Paul__B not Paul__RB, but I didn't say PaulRB either....

Oh, ok. Is there a Paul__RB on the forum, out of curiosity?

I remember having issues with pin 13 on my old Uno R2 because of the inline resistor and LED. Some functions attached to pin 13 didn't behave right. I did eventually mod my R2 so the D13 LED would match R3 schematic by lifting unused op amp pins, connecting op amp input to D13, cutting trace from D13 to LED resistor, connecting LED resistor to op amp output, and making sure the D13 pin header is directly connected to the chip. Everything I did afterward behaved correctly.