The updated code looks like this:
Now improve it. Put the input pins in an array and iterate through them to eliminate duplicated code. Declare variables with the smallest type possible such as byte instead of int when their value will never exceed 255. Declare variables as const when their value will never change, such as pin numbers.