+ 2

OMG! IS THIS AN ERROR?

Run this code and see the magic!

28th Jul 2017, 5:13 PM
Vasanth Mani Vasi Venkatram Vasi
Vasanth Mani Vasi Venkatram Vasi - avatar
6 Réponses
+ 2
You did not initialize variable 'b', so it contains some random value in your loop. You then multiply 'a' with this random value, which is the reason for your "strange" results.
28th Jul 2017, 5:21 PM
Ettienne Gilbert
Ettienne Gilbert - avatar
+ 6
https://code.sololearn.com/cJitg44awuJK/?ref=app Check this out. Maybe my explanations or the code will help with your understanding.
28th Jul 2017, 5:54 PM
J.G.
J.G. - avatar
28th Jul 2017, 5:13 PM
Vasanth Mani Vasi Venkatram Vasi
Vasanth Mani Vasi Venkatram Vasi - avatar
+ 1
but how did that random value come?
28th Jul 2017, 5:26 PM
Vasanth Mani Vasi Venkatram Vasi
Vasanth Mani Vasi Venkatram Vasi - avatar
+ 1
ok thanks both... I still cant understand lol
29th Jul 2017, 5:55 AM
Vasanth Mani Vasi Venkatram Vasi
Vasanth Mani Vasi Venkatram Vasi - avatar