0

I'm having difficulty breaking out of this nested loop. This is a function for reducing a fraction. Normally original_num and original_denom will be numbers that are reducible and z will normally be the GCD. Sometimes like in this particular that you see here 37 and 51 are not reducible. The only two ways I know of to break out of a loop is with a break statement or return 0, but in this case neither will work. I have a void statement so can't use a return statement and its a nested loop so I can't use a break statement.

```
void reduce(int original_num, int original_denom, int *reduced_num, int *reduced_denom)
{
int z = 1;
int a = 0;
int b = 0;
int original_num = 37;
int original_denom = 51;
//int i = 0;
a = original_num;
b = original_denom;
//z = gcd(original_num , original_denom);
printf("The value of z is %d\n", z);
while(a / z != 0)
{
if((a / z) != 0)
{
a /= z;
}
else if(a / z == a)
{
break;
}
}
while(b / z != 0)
{
if((b / z) != 0)
{
b /= z;
}
else if(b / z == b)
{
break;
}
}
*reduced_num = a;
*reduced_denom = b;
}
```