Code

#include <avr/io.h>
#define SW 0   
#define LED 1
int main(void)
{     
   DDRB &= ~(1<<SW);  //switch as input
   DDRB |= (1<<LED); //led as output  
   while(1)
   {
	   if ((PINB&(1<<SW)) == 1)
	   PORTB |= (1<<LED);
	   PORTB &= ~ (1<<LED);
   }
}

Schematic

Schematic AVR Interfacing Switches & LEDS.JPG Code and Explanation will be updated soon..