Question bank › Math
Dsa Math Medium

Fraction Simplifier

Write a program that reads two integers, the numerator and the denominator of a fraction. The program should simplify the fraction to its lowest terms by dividing both the numerator and denominator by their greatest common divisor (GCD). Input format: Two lines, the first line contains the numerator (an integer), and the second line contains the denominator (an integer). Output format: Print the simplified fraction in the format 'numerator/denominator'. Example: Input: 8 12 Output: 2/3

Key concepts

fractionsgreatest common divisormath

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.