Bitwise Operators

Lab C Intermediate 20 points

Read two non-negative integers a and b. Print a & b, a | b, a ^ b, a << 2 and a >> 1.

Input

Two integers.

Output

One line, five numbers.

Example

Input

12 10

Output

8 14 6 48 6
Sample input available Sample output available
Editor
C

Hints

& keeps bits set in both, | in either, ^ in exactly one.

Solution explanation

Shifting left by k multiplies by 2ᵏ; shifting right divides by 2ᵏ.

Show solution
#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d %d %d %d %d\n", a & b, a | b, a ^ b, a << 2, a >> 1);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD