Computer Science, asked by boy3121, 1 year ago

evaluate the following expression a*(++b)%c if a=2, b=3 and c=9 (it's a computer question)

Answers

Answered by shardul1925
84
Hello!!!


Consider this following snippet::::


int a=2 ;
int b=3;
int c=9;
int z= a* (++b) % c;


Process::

z=a* (++b) %c
z=2*(++3)%9
z=2*4%9 (prefix function increases the value of b by +1)
z=2*4(in computer,mod function is first operated.
z=8


You can also refer to the attachment ☝️☝️
Attachments:

shardul1925: srry.. multiplication function is done first...so 8%9=8.
Similar questions