Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

=+3 In what ways can an MNE improve or change its approach to IHRM?

Answered: 1 week ago