[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Basics

Home > Programs > Basics

106 / 279

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: