write a c program to check weather a particluar bit is set
or not?
Answer Posted / valli
#include<stdio.h>
main()
{
int n,p;
printf("enter number");
scanf("%d",&n);
printf("enter the position");
scanf("%d",&p);
if(n&(1<<p))
printf("the bit is set");
else
printf("the bit is clear");
}
| Is This Answer Correct ? | 12 Yes | 3 No |
Post New Answer View All Answers
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Explain the Difference between the New and Malloc keyword.
How can I remove the leading spaces from a string?
What do you mean by keywords in c?
With the help of using classes, write a program to add two numbers.
What are the different types of pointers used in c language?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What is the condition that is applied with ?: Operator?
What is the best way to store flag values in a program?
What is the difference between printf and scanf in c?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
How can I write a function analogous to scanf?
What is a constant and types of constants in c?
What is the use of gets and puts?
What are enumerated types?