+ 8
[UPDATE: NO IT'S NOT A wrong answer (was "wrong answer" first)] Challenge in Java
What is the output? public class Main { public static void main(String[] args){ int sum=0, bum=0; for(int i=1;i<=5;++i) sum+=i; for([deleted] i=1;i<=5;i++) bum+=i; if(sum==bum) System.out.print("1"); else System.out.print("0"); } } I gave the answer "1". And it was wrong (right answer:error)! Another fellow sololearner found out there really was an error (see comments). Typed code in playgrounds, so you can see it yourself: https://code.sololearn.com/ctCgXzNI2oR5/?ref=app
23 Réponses
+ 11
Playground code does not match. Again look at the 2nd for loop in the question, it does not have "int" written before the i. It cannot use the i from the first for loop.
edit: I agree I don't like that question either. 😛
+ 13
Notice the int declaration is missing on the 2nd for loop. This is an error, the code is correct.
its: "for(i=1...)"
not: for(int i = 1)..."
+ 10
Pls report the question.
+ 10
Thx, Andrew. You've done a good job ^^
+ 10
ehhhh I think they'll ignore the report when they find out the question is right, I'm sure they get lots of reports like that.
+ 10
lol, well I think a missing semi-colon is as close to reality as you get. 😛. Maybe the boss is asking if you've finished it, and the question is 1000 lines of code long. Find the missing semi-colon.
As real as it gets😅
+ 9
Yup you're right. Report the question.
Make sure you wrote the question correctly too. There could have been something small you missed to cause the error.
+ 9
@Andrew I guess reporting is enough :D
If you suggest mods do have the power to edit anything in here - well, we don't.
+ 7
Yep! I was wrong! (I think it's a bad question... but ok) That's why it was right decision to post it here (and it was wrong decision to report it before discussion and review, my fault). To discuss, review and recheck! And to find out where I was wrong. :-/
+ 7
Math and for loops 😊
you guys get aawwll the fun!
+ 5
@Rrestoring faith Thank you! I've edited the answer, the question and some comments (and code too) to notice every one reading it that I was wrong! What an Eagle eye you are! ;-) (And I just automatically typed for loop in a right way when was checking it...) :-))
+ 5
How can I recall report? :-) I'm sure it's not possible. :-( So... sorry devs watching those reports! 😇 I'm very sorry
+ 5
@Rrestoring faith Lucky we are! ...having modern IDEs! ;)
+ 4
@Tashi Done it already, but was disappointed that I can't give commentaries to my report. And wanted to commit code typed in playgrounds, so here it is.
+ 4
[OOPS! I WAS WRONG, SEE BELOW] @Rrestoring faith "Measure twice, cut once". Done. And now any other can check (recheck) it after me. But to get easy access to question you should be in Sololearn team, right? Oh! I can make a screenshot and post it at some picture exchange site. Ok, wait a minute...
+ 4
@Tashi N No I haven't suggested... emm... such (is it right to say so?) But any other sololearners who encountered that question and left it thinking "strange, there must be a typo somewhere I didn't notice" may now report it too. For example Sololearner whom I have challenged that type (has given wrong answer too which is not a surprize) and who liked this question already can report it too. That's what I suggest: the more reports the faster (wrong) question will be disintegrated! :-)
+ 4
I know more tricky questions! One should exchange some latin "a" to a cyrillic "а" in code (exactly the same in most fonts) or even to "á" or at least write "Syslem.out.prlnt();"... you know... Just joking. ;-)
+ 4
If someone wants question to be close to reality as much as possible they should add a voice of project manager who will ask every 5 second "Have you finished? Have you finished, yet?" (reminds me of "Shrek") ;-))) (Well, I don't have a job in development yet, but I already feel it... maybe there should be also "No-no-no! We wanted it to be fully the other way!")
+ 3
@Rrestoring faith We should do something about it. :-) But I don't know what. :-( Brainstorm?