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...

write a c program to check weather a particluar bit is set
or not?

Answer Posted / santhi perumal

#include<stdio.h>
#include<conio.h>

int main()
{
int number;
int position;
int result;

printf("Enter the Number\n");
scanf("%d",&number);
printf("Enter the Position\n");
scanf("%d",&position);

result = (number >>(position-1));

if(result & 1)
printf("Bit is Set");
else
printf("Bit is Not Set");
}

Is This Answer Correct ?    33 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how can you determine the size of an allocated portion of memory?

1106


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3508


How can I ensure that integer arithmetic doesnt overflow?

1160


Explain how do you determine the length of a string value that was stored in a variable?

1148


Explain what is the benefit of using an enum rather than a #define constant?

1217


what will be maximum number of comparisons when number of elements are given?

1901


Explain how can I read and write comma-delimited text?

1159


Explain what are multidimensional arrays?

1062


what are bit fields in c?

1700


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1365


Which is better pointer or array?

1021


Explain the advantages of using macro in c language?

993


What are the different types of objects used in c?

1024


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

1004


What are the advantages of the functions?

1158