#include <stdio.h>

/* any other #includes you think you need */

void inputFraction(int *numerator, int *denominator);

/* Prompts for and inputs a fraction with input verification */

void reduceFraction(int *numerator, int *denominator);

/* Modifies the fraction so that it is in reduced form */

void printReducedFraction(int numerator, int denominator);

/* Prints the reduced fraction numerator/denominator with appropriate message

Calls reduceFraction

*/

int gcd(int x, int y)

{

if ( x % y == 0)

return y;

return gcd(y,x%y);

}

/* Do not modify the main function */

int main()

{

int num, denom;

char response;

printf("\nThis function inputs fractions and prints the equivalent fraction in reduced form.\n\n");

do {

inputFraction(&num, &denom);

printf("\n");

printReducedFraction(num,denom);

/* First clear the buffer, especially of any residual newline! */

while (getchar() != '\n');

printf("\nDo you wish to process another fraction (Y for yes, N for no):");

response = getchar();

printf("\n");

} while (toupper(response) == 'Y');

return 0;

}

/* You must supply the definitions of the functions above main except for gcd */