What will be the value of following, if j=5 initially? (5* ++j)%6 (5*j++)%6

Q24. What will be the value of following, if j=5 initially?

  1. (5* ++j)%6
  2. (5*j++)%6

Ans.

  1. (5* ++j)%6

initially j=5

after increment operator ++j, value of j =6

(5*j)%6

(5*6)%6

30%6

0

2. (5*j++)%6

initially j=5

after increment operator j++, after performing operation, value of j =6

(5* j++)%6

(5*5)%6

25%6

1

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: