+ 24
[ASSIGNMENT] Long calculation
Your 5-year old relative wants to learn how to do long addition/subtraction/multiplication/division but keeps on forgetting what to do. Thus you decided to help him out by making a simple code for him. Your code should take a one-liner input, the calculation done e.g. 67+92 These are the inputs and their outputs calculate('47+89') 1 4 7 + 8 9 --------- 1 3 6 --------- calculate('86-48') (7) 1 8 6 - 4 8 --------- 3 8 --------- So you get the essence? Start coding now!
60 Answers
+ 21
I enjoyed this so much! ๐๐!
My try (Addition & Subtraction & Multiplication & Division):
https://code.sololearn.com/W6w3bIRGpEU6/?ref=app
+ 14
$Vengat : I am sure that this is the hardest among all the 68 code challenges I played.
+ 11
$Vengat : Did the changes you asked! Check the code now.
+ 11
I gave up on this challenge. Too hard especially if you use java.
+ 10
And, do you think I should change something in my code? If so, mention it and I will try to do it.
+ 9
Can the input be more than one line? Im having a hard time doing it
+ 7
@Krishna sir great code๐๐
+ 7
Is there some range limit for C++ users? You see, we can't store numbers > 2^32 -1 in long long, but since this is a code for a 5 year old, I assume this limit is enough...
+ 7
My division algorithm works for 9279/59 and 92793/69, but gives a wrong answer in 999/3. I am not able to understand why. Help!
https://www.sololearn.com/Discuss/744571/long-calculation-help-in-division-needed
All I need is something that works for all cases, and the Rem function is all that needs to be rewritten...
+ 7
I tried ....but got little success... working only for (+)
update 1: Another try....come up with solution for both (+ and -) operations. Also with some more development in the older logic...
update 2: One more try....and got the solution for multiplication (*) also....now my code is working for (+, -, *).....
https://code.sololearn.com/cioKl107L2B4/?ref=app
https://code.sololearn.com/cji8u1rlrCI6/?ref=app
https://code.sololearn.com/c7T4tvd6AH2n/?ref=app
+ 6
Sir Krishna is a genius!
Happy I helped in his joy!
Not quite what I wanted but oh well,it is really good
+ 6
@ReimarPB
Who, Me? No I didn't. I make my codes myself...
This is a continuation of Yash Thatte's Code... And the mult and divt functions are as original as they can be...
+ 6
Now my code is updated for addition(+), substraction(-) and multiplication (*)....
Request to all .....
kindly chcek my code and give your views plz...
https://code.sololearn.com/cioKl107L2B4/?ref=app
+ 5
Your stuff looks different from what ive learned in school
+ 5
Very Long Challenge... ยฟยฟยฟ-_-???
+ 5
Good job for the addition part
+ 5
Nope.
I am gonna make an awesome login-logout system with python using file writing
+ 4
No, you must be able to remove the operator yourself
+ 4
Personally I prefer Ben Lobb's it has no additional 0s