Question: 1. Write a C program called check_even.c that checks if a given integer is even or odd. This program should prompt (ask) its user to

 1. Write a C program called check_even.c that checks if agiven integer is even or odd. This program should prompt (ask) its

1. Write a C program called check_even.c that checks if a given integer is even or odd. This program should prompt (ask) its user to provide a value between 0 and 255. Then, it would store this value as an 8-bit unsigned integer, check if it is even or odd, and print the corresponding message on the screen (e.g., The number is odd"). If the user inputs a value that is wider than 8 bits (larger than 256), the program should consider only the least significant 8 bits and discard the rest. What happens when the user provides a negative value? 2. Solve a puzzle. Consider the following C program, with two variable values redacted. Note that the short int type is 16 bits (2 bytes) wide, and the output statements all use (unsigned) decimal, not hex. #include int main() { unsigned short int s = /* ??? */; unsigned short int t = /* ??? */; printf("s >> 8 = %u ", s 8 ); printf("s & xff = %u ", s & 0xff ); printf("s ^t = %u ", s ^ t ); return 0; } Given (below) the output of this program, can you deduce the values of the variables s and t? You may have to convert the unsigned integer values to hexadecimal or binary. s >> 8 = 128 s & 0xff = 15 s ^ t = 36863

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!