DevJourney · code I wrote while learning

README.md

900 B

Single File Programming Question

Problem Statement

Implement a Fraction class that represents a fraction with a numerator and a denominator. Overload the '+' operator to add two fractions and return the result as a simplified fraction.

Function Specifications: Fraction operator+(const Fraction& other) const

Input format :

The input consists of two lines.

Each line contains two integers separated by a space.

The first line represents the numerator and denominator of the first fraction.

The second line represents the numerator and denominator of the second fraction.

Output format :

The output displays the sum of the fractions of the given input as simplified values.

Sample test cases :

Input 1 :

1 2 3 4

Output 1 :

5/4

Input 2 :

5 6 1 3

Output 2 :

7/6

Whitelist Set 1: Fraction operator+ Fraction operator+(const Fraction& other) const