+ 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.
27 ответов
+ 6
Finally I can now post!
Here's my try:
https://code.sololearn.com/Wa2Dap8wQnMc/?ref=app
+ 12
Thank you for the challenge 👍
Here is my try:
https://code.sololearn.com/ce44xnJfyRrr
+ 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
+ 10
@Yash oops, I revealed my biggest secrect!😆😆
+ 7
cool
+ 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
+ 4
Here is my ruby attempt, hope you like it:
https://code.sololearn.com/cKR6L18B7eZR
+ 4
My first attempt
https://code.sololearn.com/cw0FAYkb2H4z/?ref=app
+ 4
Here's my try
https://code.sololearn.com/cQbXgGpiIq7g/?ref=app
+ 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!
+ 4
Very interesting challenge as always, here goes my try:
https://code.sololearn.com/cT8hDlr3Bq0P/?ref=app
+ 4
Oh wait I haven't worked it!
+ 3
My solution... 🙌😆
https://code.sololearn.com/cr03qh4mj4U3/?ref=app
+ 3
This really is a good challange.Thank you
https://code.sololearn.com/c71v26Fiml9b/?ref=app
+ 3
https://code.sololearn.com/cLwyCB2SjrZ5/?ref=app
+ 3
My java version which can add any 2 fractions together and returns the result!
https://code.sololearn.com/c3ooh2um0w0q/#java
+ 3
Test to see if this question is blocked, if you see this you know it is not. You may remove this entry.
+ 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
+ 3
added the input (parser for adding)
https://code.sololearn.com/cG1lJP6hwjcs