+ 1
Help me why this output ââ ???
#include<stdio.h> #include<stdlib.h> int main(){ int x=9; x%=11; printf("%d",x); return 0; } //output:9 intead of 0
2 Answers
+ 4
Why 0?
x%=9 means x = x%11= 9%11 = 9
See here
https://www.sololearn.com/discuss/2988130/?ref=app
+ 1
it works like this
y=x%a;
if (x<a)
y=x;
else
y=x%a;
example:
y=3%4; //3<4 so y=3
y=4%3; // 4>3 so we get the reminder so y=1