+ 27
[Solved] How the answer is -0?😨
I just wrote a simple program in c++ . My code is: https://code.sololearn.com/cOSdnLC3MUgJ/?ref=app I became surprised when I saw the answer is -0. Thanks in advanced.
15 Respuestas
+ 10
Web-Learner
From mathematical point of view,
-0 and 0 is same number.
So it should automatically transfered to 0.
+ 8
Tanitoluwa Winter please don't spam in Q&A.
+ 7
Tanitoluwa Winter please don't spam .
+ 4
It though may not satisfy you, but it's an interesting post I found (Not related to C++)
https://softwareengineering.stackexchange.com/questions/280648/why-is-negative-zero-important
+ 3
Because you didn't used absolute value for c
+ 3
From a mathemitacal point of view,
10/5=2
-10/5=-2
So:
-0/5=-0
+ 2
Beacause
0 is divide by any number it gives 0 and there is in negetive so answer is also negetive
+ 2
Because you not used there another value..
+ 2
-0 "might" means that you have reached the value "zero" from lower numbers.
But in school I've always found written 0¯. So I don't know.
+ 2
Tanitoluwa Winter ,please don't ask question in the answer of a question .If you need any help about programming related or about sololearn you can ask
in Q&A discussion but make sure use the search bar before posting any question. If you don't understand the sololearn forum you can see this:
https://www.sololearn.com/post/52212/?ref=app
https://www.sololearn.com/post/432150/?ref=app
+ 1
-0 & 0 is same
+ 1
Because you used b= -5 ,
a/b =0/-5 = -0
Maybe I am wrong
+ 1
Very Good Find its really intriguing question.
0
you should just use absolute value for c but only in case which a is 0