Can someone help me?

This is supposed to work with Serial communication and button matrix. The problem is when i press button then its stays on or when i don’t touch the button it goes on.
Sorry my bad english.
Code is here:
int S1 = digitalRead(2);
int S2 = digitalRead(3);
int S3 = digitalRead(4);
int S4 = digitalRead(5);
int S5 = digitalRead(6);
int S6 = digitalRead(7);
int S7 = digitalRead(8);
int S8 = digitalRead(9);
int S9 = digitalRead(10);
int S10 = digitalRead(11);
int S11 = digitalRead(12);
int S12 = digitalRead(14);
int S13 = digitalRead(15);
int S14 = digitalRead(16);
int S15 = digitalRead(17);
int S16 = digitalRead(18);

int inputs =
{2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18};
void setup() {
Serial.begin(9600);
for (int io = 0; io < 16; io++) {
pinMode(inputs[io], INPUT);
}
}

void loop() {

if(Serial.available()){
if(S1 == HIGH){
Serial.write(“S1”);
}else{

}
if(S2 == HIGH){
Serial.write(“S2”);
}else{

}
if(S3 == HIGH){
Serial.write(“S3”);
}else{

}
if(S4 == HIGH){
Serial.write(“S4”);
}else{

}
if(S5 == HIGH){
Serial.write(“S5”);
}else{

}
if(S6 == HIGH){
Serial.write(“S6”);
}else{

}
if(S7 == HIGH){
Serial.write(“S7”);
}else{

}
if(S8 == HIGH){
Serial.write(“S8”);
}else{

}
if(S9 == HIGH){
Serial.write(“S9”);
}else{

}
if(S10 == HIGH){
Serial.write(“S10”);
}else{

}
if(S11 == HIGH){
Serial.write(“S11”);
}else{

}
if(S12 == HIGH){
Serial.write(“S12”);
}else{

}
if(S13 == HIGH){
Serial.write(“S13”);
}else{

}
if(S14 == HIGH){
Serial.write(“S14”);
}else{

}
if(S15 == HIGH){
Serial.write(“S15”);
}else{

}
if(S16 == HIGH){
Serial.write(“S16”);
}else{

}

}
}

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn’t show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor you will not have access to this useful tool but it’s still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason or random blank lines just make for more scrolling when we’re trying to read your code. Do not post double spaced code.

You need to move your digitalRead() statements to inside loop() if you want the pins to be continuously read. As is, you just read them once when the program first starts.

If you don’t have pull-down resistors you will also have problems. If not I would actually recommend using the internal pull-up resistors and changing your logic from active HIGH to LOW. See the description of INPUT_PULLUP here:

and here: