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 find a 5th bit is set in c program

Answer Posted / sumit kumar

Take the input 5 from keyword :-
#include<stdio.h>
main()
{
int num,pos;
printf("enter the no.:");
scanf("%d",&num);
printf("enter the position:");
scanf("%d",&pos);
if(num & (1<<pos))
{
printf("pos is set");
}
else
{
printf("pos is not set");
}
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is #define size in c?

1128


The difference between printf and fprintf is ?

1224


What is the correct declaration of main?

1164


What is c preprocessor mean?

1256


c language interview questions & answer

1911


What are the types of unary operators?

1145


How can you check to see whether a symbol is defined?

1062


What is the difference between malloc() and calloc()?

1710


Does c have class?

1056


What is the modulus operator?

1165


What does void main () mean?

1191


Explain what is a program flowchart and explain how does it help in writing a program?

1055


What type is sizeof?

1010


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1737


Which is more efficient, a switch statement or an if else chain?

976