Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
Practice Tech Mahindra Essay Topics

Program Discussion :: Basics

Home > Programs > Basics

23 / 259

write a program to set the nth bit .

Answer:

#include 

#include
using namespace std;
int main()
{
    int num, n, newNum; 
    /*Reads a number from user*/
    coutnum;
    /*Reads the bit number you want to set*/
    coutn; 
    /*Right shift 1 to n times and perform bitwise OR with number*/
    newNum = (1 

Asked In :: Alcatel-Lucent

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: