If you must use if
statements only, then just chain them all.
if (resp_1 == 1) {
// Print output for 1
} else if (resp_1 == 2) {
// Print output for 2
} else if (resp_1 == 3) {
// Print output for 3
} else if (resp_1 == 4) {
// Print output for 4
} else {
// Print error
}
An if-else statement executes (exactly) one branch. And here each else branch is another if-else statement. So, only one branch will be executed; either one of the branches for valid input, or the last catch-all else branch.
And while it's possible to use a flag and write this without a single else
clause, IMO it will be far less clear what you intended to happen. When writing code, always go for the option that best captures your intent. Two weeks down the line, if the code requires clarification, it'll be all that easier to explain it to yourself first.