#include <stdio.h>
int main() {
int num = 5;
printf("Original number: %d\n", num);
num = num << 3; // Multiply by 2^3 = 8
printf("After multiplication by 8: %d\n", num);
return 0;
}
Inside the main() function:
- An integer variable num is initialized with the value 5.
- The original value of num is printed to the console.
- The num variable is left shifted by 3 bits using the `<<` operator, effectively multiplying it by 8 (2^3).
- The result after multiplication is printed to the console.