Your first step in these kinds of problems is always to make a logic table.
A | B | Result
-------------------
T | T | do action C
T | F | ...
F | T | do action C
F | F | do action C
Once you’ve made the table, the solution is clear.
if (A && !B) {
...
}
else {
do action C
}
Do note that this logic, while shorter, may be difficult for future programmers to maintain.