0
What?
What is the output of this code? int x; string y="''; for (x = x x<= 30; x++) { if (x % 2 == x % 4) break; y += Convert. ToString(x); Console. Write (y); Why is y 23??? At the time when x=4 in the loop the bool is true or not? I mean 4%2=0 and 4#4 is also 0, which means 2%2=0=4%2. in this case y should be 4 ?
6 Réponses
+ 3
the closing } is missing.
x is not initialized and the head of the for-loop is missing a a semicolon. There are blamknspaces between Convert. and ToString as well as between Console. and Write.
0
Tag the relevant programming language.
Show the complete code.
Check quotation marks, semicolons, blank spaces, and matching brackets.
0
The language is c#. I dont have mor code, this was a question in the quiz duel. I just dont get it đ€
0
Nico Philipp, your code is is syntactically incorrect. Lisa is right. But I don't understand why you need this code? In any range, up to 30, up to 100, or up to 1,000,000, the y number will be equal to 0, since 0 corresponds to the condition in the if. I corrected all the errors and typos in your code.
https://sololearn.com/compiler-playground/cQJSJ4GH2tm8/?ref=app
0
Guys its not my code its a code from the quiz duel⊠i just hopef someone could help me understand why the answer was 23 and not 4
0
The code will produce a compilation error. No output.