Hi, i'm a beginner at this. I'm having trouble understanding this program.
This program is to find the largest factor of a number. I don't quite understand how the " factor-- " works. How would i trace this program to better understand it? Thanks in advance!

ex. user enters 24, largest factor = 12



int main() {
int number;
cout << "Enter an integer that is larger than 1: " ;
cin >> number;

if (number <= 1) exit (1);

int factor = number -1;
while ((number % factor) > 0) factor--;
cout << "The largest factor is: " << factor << endl;

return 0;
}