+ 1
Why answer is 8 ?😅
#include <iostream> using namespace std; int main() { int x=4,y,z; y=--x; z=x--; cout<<x+y+z; }
7 Antworten
+ 5
Here is the explanation :
https://code.sololearn.com/cl9c6clcHDVq/#cpp
+ 3
Are you sure?
cout << y << z << x;
Will output all three variables <y>, <z> and <x>. Did you mean something like this?
cout << (y + z + x);
This way it makes sense ...
+ 2
y = --x decrease and then assign
z = x-- assign and then decrease
+ 1
while printing the values of x,y,z
y=3
z=3
x=2
is the output and i dont know why 😅
+ 1
Is this one from challenges?
If the snippet shown was exactly like that, and it says answer was 8, then the challenge is faulty.
+ 1
Capture the screen bro! if the snippet was exactly like that, and it says answer is 8, then the challenge is faulty, and it is worth to be reported.
Some learners will be confused and mislead by that mistake, SoloLearn needs to know about this so they can do something about it.
+ 1
oh okie ...will report that