what will be the output, if x=5? (a) 5*++x (b) 5*x++
Answers
Answered by
145
x=5
5*++x=5*(5+1)
x=5*6=30
(b) x=5
5*x++
=5*5
=25
5*++x=5*(5+1)
x=5*6=30
(b) x=5
5*x++
=5*5
=25
Answered by
0
Answer:
The output of (a) 5*++x = 30
(b) 5*x++ = 25
Explanation:
The operator used in the expression (a) 5*++x = 30, is known as the pre-increment operator. In which the value is incremented by 1 before assigning the value to the variable.
Whereas, the operator used in the expression (b) 5*x++ = 25, is known as the post-increment operator. Where, after assigning a value to the variable, the value is incremented.
#SPJ3
Similar questions