Can someone plz explain me this it is of java and output is coming 126
why??
Attachments:
Answers
Answered by
0
Explanation:
Here m++ and n++ are postfix operators so they will increase m and n by 1 but after the calculation m++×n++ is performed so here 10×12=120.
Now the value of n has been increased by 1 by postfix plus so n=12+1=13.
and --n this is prefix subtraction so it will reduce the value of n by 1 before the calculation IS finished so n=13-1=12
then n/2=12/2=6
120+6=126
Answered by
1
m++ and n++ are post increament operator hence,
this will used the previous value then increase the value by 1.
But --n is pre decreament. operator which first decreased the value by 1 then used for the value.
p=(m++*n++)+--n/2;
p=10*12+(12/2)
=>120+6
=126........ Output
Similar questions