#include<stdio.h>
// Author- Khadiza Sultana
// 10/8/2024
// Takes a fraction and prints the lowest form of the fraction

int main() {
    int a, b, x, y, gcd; // Take two integers as input
    printf("Enter the fraction (a/b): ");
    scanf("%d/%d", &a, &b);

    x = a;
    y = b;

    // Using Euclidean algorithm to find the GCD of a and b
    while (y != 0) {
        int remainder = x % y;
        x = y;
        y = remainder;
    }

    // x now contains the GCD
    gcd = x;

    // Dividing both numerator and denominator by GCD to get the reduced fraction
    a = a / gcd;
    b = b / gcd;

    printf("In lowest terms: %d/%d\n", a, b);
    
    return 0;
}