Can anyone tell me the answer for this question int X=9 and X%=11,printf("%d",X).what is the value of X? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell me the answer for this question int X=9 and X%=11,printf("%d",X).what is the value of X?

C language

3rd Jul 2019, 3:48 PM
Nagadeepthi
Nagadeepthi - avatar
6 Answers
+ 1
% - indicates Modulus operator, that gives the remainder. X%=11- > X = X%11 = 9%11 =9 - > 9 can not be divided by 11. So, remainder is 9. So, Is the answer. Hope this helps...!!!
3rd Jul 2019, 4:32 PM
Kuri
Kuri - avatar
0
It's 9
3rd Jul 2019, 3:53 PM
Agent_I
Agent_I - avatar
0
tq Agent_I can u pls tell me the process
3rd Jul 2019, 4:17 PM
Nagadeepthi
Nagadeepthi - avatar
0
Nagadeepthi The % is a modulo operation, it calculates the remainder of a division operation. X = 9, X %= 11, so it can be written as x = x % 11. 9 divided by 11 has a quotient of 0 and has a remainder of 9 9 = 11 * 0 + 9
3rd Jul 2019, 4:25 PM
Agent_I
Agent_I - avatar
0
tq Agent_I
3rd Jul 2019, 4:27 PM
Nagadeepthi
Nagadeepthi - avatar
0
tq Nagendra
3rd Jul 2019, 4:35 PM
Nagadeepthi
Nagadeepthi - avatar