Why my code as just for one input and ad allways 8 for the second one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why my code as just for one input and ad allways 8 for the second one?

5th Nov 2018, 9:41 PM
pablo
4 Answers
+ 4
Shadow Someone asked earlier about the same. https://www.sololearn.com/discuss/1574934/?ref=app For some reason the garbage value is always 8 in this specific situation.
5th Nov 2018, 10:12 PM
Anya
Anya - avatar
+ 2
pablo Its hard help you without see your code
5th Nov 2018, 9:46 PM
KrOW
KrOW - avatar
+ 2
Without seeing the code I'd have to guess, but most likely the reason is that the scripts here on Sololearn are sent to an online compiler, which means you have to give all input at the beginning of the program. If you have multiple inputs, you have to split them with a newline, e.g. 7 8 ... I suppose you provided only one input, so the second variable is used without prior initialization, meaning it has some random garbage value, in this case 8.
5th Nov 2018, 9:48 PM
Shadow
Shadow - avatar
+ 2
Anya Yes, I also always get the same values here. Sololearn seems to have "fixed" garbage values, I don't exactly know why though. Must be something about how/where the scripts are compiled.
5th Nov 2018, 10:19 PM
Shadow
Shadow - avatar