What would the outputs for both of these programs look like

What would the outputs for both of these programs look like? #include int main() {printf (\"%d\ \", 10 & -1 1 011 11 101 && 66^6 & 6); return 0;} #include int main() {printf(\"%d %d\ \". 32 -0); return 0;}

Solution

Please follow the code and comments for description :

a) CODE :

#include <stdio.h> // required header files

int main() // driver method
{
    printf(\"%d\ \", ~!0 & !~1 | 1 || 011 || ~~!101 && 66 ^ 6 & 5); // print the output to console

    return 0;
}

OUTPUT :

1


b) CODE :

#include <stdio.h> // required header files

int main() // driver method
{
    printf(\"%d %d\ \", 32<<1, 32<<0); // print the output to console
    printf(\"%d %d\ \", 32<<-1, 32<<-0);
    printf(\"%d %d\ \", 32>>1, 32>>0);
    printf(\"%d %d\ \", 32>>-1, 32>>-0);

    return 0;
}


OUTPUT :

64 32
16 32
16 32
64 32


Hope this is helpful.

 What would the outputs for both of these programs look like? #include int main() {printf (\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site