What does the following program do?
1 // ex10_17.c
2 #include
3
4 int mystery(unsigned int bits); // prototype
5
6 int main(void)
7 {
8 unsigned int x; // x will hold an integer entered by the user
9
10 puts("Enter an integer: ");
11 scanf("%u", &x);
12
13 printf("The result is %d\n", mystery(x));
14 }
15
16 // What does this function do?
17 int mystery(unsigned int bits)
18 {
19 unsigned int mask = 1 « 31; // initialize mask
20 unsigned int total = 0; // initialize total
21 for (unsigned int i = J.; i <= 32; ++i , bits «= 1) {
23
24 if ((bits & mask) == mask) {
25 ++total;
26 }
27 }
28
29 return !(total % 2) ? 1 : 0;
30 }
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.