+ 28

🔴CHALLENGE🔴 parse rational numbers!🔰

Write a program in any language which takes an input of the following form and parses the two rational numbers from it and performs the addition operator and returns the result as a fraction (rational number) again. Exalmple: input 5/6+3/4 output: 19/12 You should simplify the result of the addtion before printing it. For example if you get 8/12 you should print 2/3.

13th Nov 2017, 12:05 PM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
30 Réponses
+ 6
Finally I can now post! Here's my try: https://code.sololearn.com/Wa2Dap8wQnMc/?ref=app
18th Nov 2017, 12:40 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 12
Thank you for the challenge 👍 Here is my try: https://code.sololearn.com/ce44xnJfyRrr
17th Nov 2017, 11:52 AM
LukArToDo
LukArToDo - avatar
+ 12
Dear coders who kindly answered my challenge, I appreciate your efforts and your great codes. Related to this challenge I have created a custom class (in Java) in github for all calculations on rational numbers including parsing strings into rational numbers. Here is the link: https://github.com/shirbisheh/Rational-numbers-in-Java
27th Nov 2017, 8:48 AM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
18th Nov 2017, 10:02 AM
David Akhihiero
David Akhihiero - avatar
+ 10
@Yash oops, I revealed my biggest secrect!😆😆
27th Nov 2017, 8:56 AM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
+ 7
cool
28th Nov 2017, 8:08 AM
Jaydeep Khatri
Jaydeep Khatri - avatar
+ 5
What do you guys think of my take? Please do review it. It's neat and documented (at least I think so ;) ) and self-explanatory variables have been used when possible. https://code.sololearn.com/c2OpQe37iV1c/#py
19th Nov 2017, 2:28 PM
Bimal G
+ 4
Here is my ruby attempt, hope you like it: https://code.sololearn.com/cKR6L18B7eZR
14th Nov 2017, 11:50 PM
Uria
15th Nov 2017, 5:44 AM
Hamid
Hamid - avatar
15th Nov 2017, 10:51 AM
Kartik
Kartik - avatar
+ 4
Really great challenge. This one had me stumped for a whole day! (and then on top of it I saved over my code for the palindrome challenge from the other day which really pissed me off lol) But don't we all love that feeling when you finally solve the problem! Well worth it!
16th Nov 2017, 1:43 AM
Mike Weiss
Mike Weiss - avatar
+ 4
Very interesting challenge as always, here goes my try: https://code.sololearn.com/cT8hDlr3Bq0P/?ref=app
17th Nov 2017, 1:23 PM
Lucas Pardo
Lucas Pardo - avatar
+ 4
Oh wait I haven't worked it!
28th Nov 2017, 8:05 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
13th Nov 2017, 6:34 PM
~ MasouD
~ MasouD - avatar
+ 3
This really is a good challange.Thank you https://code.sololearn.com/c71v26Fiml9b/?ref=app
15th Nov 2017, 8:26 AM
Hamid
Hamid - avatar
+ 3
https://code.sololearn.com/cLwyCB2SjrZ5/?ref=app
15th Nov 2017, 8:42 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 3
My java version which can add any 2 fractions together and returns the result! https://code.sololearn.com/c3ooh2um0w0q/#java
16th Nov 2017, 1:36 AM
Mike Weiss
Mike Weiss - avatar
+ 3
Test to see if this question is blocked, if you see this you know it is not. You may remove this entry.
16th Nov 2017, 4:18 PM
Paul
Paul - avatar
+ 3
Python , no imported libraries(that could be cheating))) ) just pure code four basic operations (you may extend others with magic methods) https://code.sololearn.com/cG1lJP6hwjcs 3/4 + 5/36 = 8/9 3/4 - 5/36 = 11/18 3/4 * 5/36 = 5/48 3/4 / 5/36 = 27/5
19th Nov 2017, 11:21 PM
SergK
SergK - avatar
+ 3
added the input (parser for adding) https://code.sololearn.com/cG1lJP6hwjcs
21st Nov 2017, 3:44 AM
SergK
SergK - avatar