Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C program hat declares four variables nt my int ong long my_long unsigned int my unsigned int unsigned long long my unsigned long
Write a C program hat declares four variables nt my int ong long my_long unsigned int my unsigned int unsigned long long my unsigned long Your program may also use additional variables as as needed When the program runs, it 1. Prompts the user to input a single integer value. It should allow both positive and negative values. 2. Assigns this one value to each of the four variables 3. Prints the value of each of the four variables in decimal 4. Prints the value of each of the four variables in hexadecimal. Hint: you will need some format specifiers for both printf) and scant0 that have not specifically been covered in class. These are listed below Variable Type Format Specifier id Su %) 1d (owercase L. for-ong", not ones) %21u Xx %11x int unsigned int long long unsigned long long int (signed or unsigned) as hex long long (signed or unsigned) as hex Below are some sample outputs for this program. The wording of your messages does not have to be the same as these examples, but the numbers that are printed almost certainly should be, if you are using a relatively modern laptop or desktop computer. If in doubt, post to Discussion. Enter an integer value to assign to the variables: 25 ny int: 25 ny long: 25 my unsigned int: 25 ny unsigned long: 25 Now let's print them in hex! ny int: 19 ny long: 19 ny unsigned int: 19 my unsigned_long: 19 Enter an integer value to assign to the variables: see8800eee ny int: 705032784 ny long: 500000000e ny unsigned int: 705832784 Now let's print them in hexl ny int: 2a05f200 my long:12a85f200 ny unsigned int: 2a05f288 ny unsigned long: 12ae5f28e Enter an integer value to assign to the variables: -500 y int: -580 ny long:-5ee ny unsigned int: 4294966796 ny unsigned_long: 18446744873789551116 Now let's print them in hex! ny int: fffffeec mylong: ffffffffffffeec ny unsigned_int: fffffeec my unsigned_long: fffffffffffffeec Enter an integer value to assign to the variables: -1 y int:-1 ylong:-1 y unsigned int: 4294967295 nyunsigned long: 18446744073789551615 Now let s print them in hex yint: ffffffff ylong: ffffffffffffffff my.unsigned int: fffffff
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started