how to set Nth bit of a variable?
Answer / kirankumaryakkala
ex: int res=16, temp=1,n;
printf("enter the Nth bit no");
scanf("%d",&n);
temp=temp<<n; //leftshift to ntimes
res=res|temp; //bitwise OR
printf("setted nth bit of res %d",res);
Is This Answer Correct ? | 9 Yes | 4 No |
What is the meaning When we write "#include" what is # and what does include does there???
Can a variable be both static and volatile in c?
What is the use of pointers in C?
0 Answers Impetus, Motorola, Tavant Technologies, Virtusa,
write a program which counts a product of array elements lower than 10.
write a c program to calculate the income tax of the employees in an organization where the conditions are given as. (I.T. = 0 if income <100000 I.T = 10% if income _< 200000 it = 20% if income >_ 200000)
7 Answers Consultancy, DBU, FD, JK Associates, Kobe, Satyam,
how to write hello word without using semicolon at the end?
How do c compilers work?
Are enumerations really portable?
how can i get the string which is having two spaces at the end.suppose the string is "Hello World ".Now at the end i have two spaces.i need to print with that spaces .
How to swap 3 numbers without using 4th variable?
25. It takes five minutes to pass a rumour from one person to two other persons. The tree of rumour continues. Find how many minutes does it take spread the rumour to 768 persons. ?
11 Answers CTS, TCS,
What is auto keyword in c?