sum of fraction

I know to code for the sum of numbers but does anyone have a code to add fractions.
How do you add fractions together?

You have to make sure that the denominators are lowest common denominator then add them together.
how is your code supposed to receive fraction numbers?

aren't they are just decimals, the rest is just how you format them.
Input a,b,c,d (however you want).

(a/b) + (c/d) = (ad+bc)/(bd)

Work that out, then simplify the fraction at the end by removing the highest common factor from numerator and denominator.
Last edited on
Topic archived. No new replies allowed.