Any idea why this is happens? Insted showing result in 0 or none ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Any idea why this is happens? Insted showing result in 0 or none ?

Division by 0 can crash your program

7th Sep 2018, 11:46 AM
Mr. Nothing
Mr. Nothing - avatar
10 Answers
+ 9
https://code.sololearn.com/c7yiWUwmDY67/?ref=app it's not crashing try above code
7th Sep 2018, 11:51 AM
GAWEN STEASY
GAWEN STEASY - avatar
7th Sep 2018, 12:47 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 3
But trying to divide something by 0 is wrong. It's undefined/infinite/whatever. It can't just replace an invalid result with something like 0, none or a blank output. If it shows 0 and you use this result for further calculations, the whole result will be massively wrong.
7th Sep 2018, 12:32 PM
Anna
Anna - avatar
+ 3
"In computing, a program error may result from an attempt to divide by zero. Depending on the programming environment and the type of number (e.g. floating point, integer) being divided by zero, it may generate positive or negative infinity by the IEEE 754 floating point standard, generate an exception, generate an error message, cause the program to terminate, result in a special not-a-number value, a freeze via infinite loop, or a crash." https://en.m.wikipedia.org/wiki/Division_by_zero
7th Sep 2018, 12:42 PM
Anna
Anna - avatar
+ 2
It can't show 0 as a result because x/0 is not 0.
7th Sep 2018, 11:59 AM
Anna
Anna - avatar
+ 2
GAWEN STEASY Thankyou :)
7th Sep 2018, 12:23 PM
Mr. Nothing
Mr. Nothing - avatar
+ 2
Anna u r right but. I want a specific reason behind crash.
7th Sep 2018, 12:37 PM
Mr. Nothing
Mr. Nothing - avatar
+ 1
😁😁😁😁😁
7th Sep 2018, 12:34 PM
Mr. Nothing
Mr. Nothing - avatar
+ 1
Anna i just want right reason why this code crash program , 😂 is computer cannot understand it.? Ufff
7th Sep 2018, 12:36 PM
Mr. Nothing
Mr. Nothing - avatar
0
Anna hmm But Should Show blank output. Insted crash
7th Sep 2018, 12:24 PM
Mr. Nothing
Mr. Nothing - avatar