+ 1

Why is this coding giving if condition true?

https://code.sololearn.com/Wem9Mik237zv/?ref=app

30th Apr 2020, 5:12 PM
Jyoti Rani
Jyoti Rani - avatar
6 Antworten
+ 3
Yes actually when 25 is divided by 5 the it will live no remainder means it will return null value but you had defined again null value as number and you know that compilers always return 0 or 1 so it will consider null as 0 and because of your 4th line code null (0) become 0 which is an int. if you want that second condition should print then directly use z there instead of zero because zero contain 0 and z contains null value
30th Apr 2020, 5:40 PM
Ayush Kumar
Ayush Kumar - avatar
+ 4
If zero have any value then it will return true . But if zero will contain null value then it will go for else
30th Apr 2020, 5:17 PM
Ayush Kumar
Ayush Kumar - avatar
+ 4
hay Jyoti Rani Who said 0 is a null value . Infact 0 is a value itself . If you want to give it null just use "" double quote without any string or space in it because spaces may also considered as values
30th Apr 2020, 5:24 PM
Ayush Kumar
Ayush Kumar - avatar
+ 1
30th Apr 2020, 5:22 PM
Jyoti Rani
Jyoti Rani - avatar
0
It is not clear yet. I am not under standing if zero var have value 0 then condition gives true but when x var have value 0 condition gives false why?
30th Apr 2020, 5:32 PM
Jyoti Rani
Jyoti Rani - avatar
0
Okkk now i got it thankew😋
30th Apr 2020, 5:45 PM
Jyoti Rani
Jyoti Rani - avatar