Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to set Nth bit of a variable?



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

Post New Answer

More C Interview Questions

write a progrmm in c language take user interface generate table using for loop?

0 Answers  


What is sizeof return in c?

0 Answers  


what are two categories of clint-server application development ?

1 Answers  


What is a stream water?

0 Answers  


out put of printf(ā€œ%dā€,printf(ram));

5 Answers  


Who developed c language?

0 Answers  


What is a shell structure examples?

0 Answers  


What are header files why are they important?

0 Answers  


write a recursive program in'c'to find whether a given five digit number is a palindrome or not

2 Answers  


What is the benefit of using #define to declare a constant?

0 Answers  


main() { printf(5+"Vidyarthi Computers"); }

6 Answers  


1)what is the error in the following stmt where str is a char array and the stmt is supposed to traverse through the whole character string str? for(i=0;str[i];i++) a)There is no error. b)There shud be no ; after the stmt. c)The cond shud be str[i]!='\0' d)The cond shud be str[i]!=NULL e)i shud be initialized to 1

4 Answers  


Categories