how to find a 5th bit is set in c program
Answers were Sorted based on User's Feedback
Answer / valli
main()
{
int n;
printf("enter n:");
scanf("%d",&n);
if(n&(1<<5);
printf("5th bit in %d is set",n);
}
| Is This Answer Correct ? | 20 Yes | 2 No |
#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 ? | 18 Yes | 7 No |
Answer / rajkumar
#include<stdio.h>
void main()
{
int a;
a=a>>4;
if(a%2==1)
printf("the bit is set");
else
printf("the bit is not set");
}
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / 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 |
Is python a c language?
a c code by using memory allocation for add ,multiply of sprase matrixes
sqrt(x+sqrt(x+sqrt(x+sqrt(x))))=2; Find the value of x?
What is LINKED LIST? How can you access the last element in a linked list?
how to devloped c lenguege?
what is the difference between const char *p, char const *p, const char* const p
5 Answers Accenture, Aricent, CTS, Geometric Software, Point Cross, Verizon,
Who is the main contributor in designing the c language after dennis ritchie?
#include<stdio.h> main() { int a=1; int b=0; b=++a + ++a; printf("%d %d",a,b); }
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
How do you prevent buffer overflows in C?
how to return 1000 variables from functio9n in c?plz give me code also
can any one tell that i have a variable which is declared as static but i want this variable to be visible to the other files? how?