+ 2

What is the output

Int X=2; x= x++*x; Cout<<x; and in line x=x++*x; the last x =? Thanks...

7th May 2020, 12:02 PM
tom
tom - avatar
3 Antworten
+ 5
6 Explanation: x = x++ * x first x++ will assign value, then incremented by 1 so x will be 3 finally x = 2 * 3 = 6
7th May 2020, 12:04 PM
A͢J
A͢J - avatar
+ 1
Here given that =2 Then X asign the value of post increment of x (x++) It mean x=2*3 Then finally x =6 will be output
8th May 2020, 5:36 PM
sachin sharma
sachin sharma - avatar
0
6
7th May 2020, 12:28 PM
sachin sharma
sachin sharma - avatar