0

How do I answer this question ?

How do I answer this question ? Consider the following code snippet . 1) int i = 10 2) int n = i++%5 Question a: what are the values of i and n after the code is executed . Question b: what are the final values of i and n if instead of using the postfix increment operator (i++), you use the prefix version (++i)? I want to know how I start and which language to use to develop .

26th Oct 2020, 5:08 PM
Godefroy Ogyam Mensah Kwaku ASIAMUAH
Godefroy Ogyam Mensah Kwaku ASIAMUAH - avatar
1 Odpowiedź
0
n = i++%5 = 10%5 =0, i++=>i=i+1=10+1=11 n=0,i=11 n = ++i%5, i++=>i=i+1=10+1=11, n= 11%5 = 1 n=1,i=11 Edit : ASIAMUAH Kwaku Mensah Ogyam Godefroy https://www.sololearn.com/discuss/1690694/?ref=app
26th Oct 2020, 5:37 PM
Jayakrishna 🇮🇳