Assign a new value
Correct the waiting count
Seven lamps are waiting at intake. Two owners collect theirs, leaving five. The program needs to replace a value it already has, rather than declare the same name again.
c
#include <stdio.h>
int main(void) {
int pending = 7;
pending = pending - 2;
printf("Lamps waiting: %d\n", pending);
return 0;
}
The declaration int pending = 7; initializes the variable. The later assignment has no int: pending = pending - 2; updates that existing variable.
Read the right side first. It uses the old value, 7, and calculates 5. Only then does the assignment replace the stored value. The print call comes afterward, so it reads 5.
Run the example. If you moved the print before the assignment, it would display 7 instead. That is the same sequence issue you saw with the donation tally: the order of valid statements changes the result.