OUTPUT
Fun1 is not fun
9
CODE
#include <stdio.h>
int fun1(void){
printf("Fun1 is not fun\n");
return 45%54/5;
}
main()
{
int c;
c=fun1();
printf("%d\n", c);
}
QUESTION
Why does it output 9 from the 45%54/5? Would this not output 2? The only way I could see this being 9 is by skipping the %, (modulus division operator, right?) then dividing by 5 omitting the 54 completely but that makes no sense to me.
edit: random secondary question. If I name my file test.c, compile it with cc test.c -o test, then type “test”, nothing happens. If I compile under any other name than test, it works fine. What gives?
is
Which evaluates as:
45 mod 54 is equal to 45. I don’t see how you expect to get 2 regardless of how you order them.