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 |
Why we use break in c?
write a program that prints a pascal triangle based on the user input(like how many stages) in an efficient time and optimized code?
What do you mean by keywords in c?
What is the proper way of these job Tell me about there full work
write a program for egyptian fractions in c?
Multiply an Integer Number by 2 Without Using Multiplication Operator
Program to trim a given character from a string.
What is a macro?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
#include<stdio.h> main() { int i=5; printf("%d",i*i-- - --i*i*i++ + ++i); } tell the answer with correct reason .specially reason is important nt answer ans by turbo c is -39
What is conio h in c?
int main() { int days; printf("enter days you are late"); scanf("%d",days); if (days<=5) printf("5o paisa fine"); if (days<=10&&days>=6) printf("1rs fine"); if(days>10) printf("10 rs fine"); if(days=30) printf("membership cancelled"); return 0; } tell me whats wrong in this program? is it right?