Arduino with 8 LEDs and a switch
Some fixes:

pin==2;  should only be 1 = here. == is a comparison.

pinMode(sw3,INPUT);  make this INPUT_PULLUP, to turn on the internal pullup resistor

if(digitalRead(sw3)==HIGH){  change this to LOW, and wire your switch/button to connect the pin to GND when pressed. The internal pullup will unsure the pin is HIGH when not pressed, and the button/switch makes it LOW when pressed. The pin is thus not allowed to 'float' and return a random HIGH or LOW.