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 the -> in c?

588


what is the significance of static storage class specifier?

1667


Explain the difference between #include "..." And #include <...> In c?

635


Why doesnt long int work?

615


What does 4d mean in c?

951






What are global variables?

650


What is strcmp in c?

603


Tell us bitwise shift operators?

601


Write a program to check prime number in c programming?

601


What is the code for 3 questions and answer check in VisualBasic.Net?

1696


Differentiate call by value and call by reference?

571


Is array name a pointer?

608


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1729


What is abstract data structure in c?

533


What is the difference between pure virtual function and virtual function?

654