what will be value of (4*++a) %5 and (4*++a) %5, where a = 4
Answers
Explanation:
If a = 6 , b = (++a) + (a++) + (a++). What are the values of a and b after executing these statements?
This question is about increment and decrement operators. So , we will solve this in steps.
step 1: a = 6 (given)
step 2: b = (++a) + (a++) + (a++) ————(1)
just break this statement into three parts,,,and take first of them..
1) ++a = 7 (pre-increment) so (6+1=7) will be assigned to a.
2) a++ = 7 (post increment) it will remain same here,then value of a will be 8 in next step.
3) a++ = 8 (post increment) so now value of a will be 9 for further.
step 3: Now put the values of these three sub-steps in eq. (1) to get the value of b.
b = 7+7+8 = 22.
step 4 .in sub-step (3) we can say value of a = 9.
so,a = 9, b = 22.
I hope it's helpful for you
Answer:
prefix => first change then calculate
postfix => first calculate then change
Explanation:
( 4* 5)%5 = 0
( 4* 5)%5 = 0