#include <stdio.h>
// Function to turn on the first n bits in a number
int turnOnBits(int num, int n) {
// Use bitwise OR to set the first n bits to 1
int result = num | ((1 << n) - 1);
return result;
}
// Driver code
int main() {
// Input number and the number of bits to turn on
int num, n;
// Get user input
printf("Enter a number: ");
scanf("%d", &num);
printf("Enter the number of bits to turn on: ");
scanf("%d", &n);
// Call the function and print the result
int result = turnOnBits(num, n);
printf("Result after turning on the first %d bits: %d\n", n, result);
return 0;
}