9.1k views
2 votes
Write a programto add two fractions and display the

result fraction . Your programwill

prompt the user to input fraction 1 and fraction 2 . The

numerator and denominator of each

fraction are input separately by space​

User Lsmpascal
by
4.6k points

1 Answer

6 votes

Step-by-step explanation:

Program to add two fractions

Add two fraction a/b and c/d and print answer in simplest form.

Examples :

Input: 1/2 + 3/2

Output: 2/1

Input: 1/3 + 3/9

Output: 2/3

Input: 1/5 + 3/15

Output: 2/5

User Matthew Rodatus
by
4.8k points