Question: BIT OPS (the program) #include #include #define ODD(X) ((X) & 01) #define BITON(X,N) MISSING #define ALLON(X,S,E) MISSING //----------------------------------------------------------------------------- int main(void) { unsigned int U1,BitNumber,Start,End; printf(Enter

BIT OPS (the program)
#include
#define ODD(X) ((X) & 01) #define BITON(X,N) MISSING #define ALLON(X,S,E) MISSING //----------------------------------------------------------------------------- int main(void) {
unsigned int U1,BitNumber,Start,End;
printf("Enter an integer : "); scanf("%ud",&U1); printf("%u is %s ",U1,ODD(U1)?"odd":"even");
printf("Enter an integer and a bit number : "); scanf("%u %d",&U1,&BitNumber); printf("%u has bit %d %s ",U1,BitNumber,BITON(U1,BitNumber)?"on":"off");
printf("Enter an integer, start and end bit numbers : "); scanf("%u %u %u",&U1,&Start,&End); printf("%u has %s those bits on ",U1,ALLON(U1,Start,End)?"all":"not all");
return(EXIT_SUCCESS); } //-----------------------------------------------------------------------------
Need C code
This program already has a macro that determines whether or not an unsigned int is odd by examining the least significant binary digit. It is missing the macros for determining if the Nth least significant bit is set (counting N from the least significant bit, starting from 0), and for determng ifall bits are on in a range of positions. You must add those macros (5.0%) A couple of sample runs are > Bitops Enter an Integer31 1 is odd Enter an integer and a bit nunber 31 3 31 has bit 3 on Enter an integer, start and end bit numbers31 2 4 31 has all those bits on > Bitops Enter an integer 30 e is even Enter an integer and a bit nunber 30 6 30 has bit 6 off Enter an integer, start and end bit numbers Je 4 6 30 has not ell those bits on This program already has a macro that determines whether or not an unsigned int is odd by examining the least significant binary digit. It is missing the macros for determining if the Nth least significant bit is set (counting N from the least significant bit, starting from 0), and for determng ifall bits are on in a range of positions. You must add those macros (5.0%) A couple of sample runs are > Bitops Enter an Integer31 1 is odd Enter an integer and a bit nunber 31 3 31 has bit 3 on Enter an integer, start and end bit numbers31 2 4 31 has all those bits on > Bitops Enter an integer 30 e is even Enter an integer and a bit nunber 30 6 30 has bit 6 off Enter an integer, start and end bit numbers Je 4 6 30 has not ell those bits on
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
