My name is Matt and I'm currently in my 4th Semester as a Computer Science major. In my C++ class, we just did a Fraction reduction program. It will reduce a Fraction to its lowest terms. We went over it in class, but I just wanted to see if anyone can clarify how exactly the following for loop reduces the Fraction. Just kind of step me through it if you can and explain how it does what it does. Thanks in advance for the help!

void Fraction::reduceFraction() { int a = 0; int b = 0; int i = 0; a = denominator; b = numerator; for (i = 50; i > 1; i--) { if ((a % i == 0) && (b % i == 0)) { a /= i; b /= i; } } denominator = a; numerator = b; cout << "Reduced Fraction: " << numerator << "/" << denominator << endl; }