(Solved) : Hwi Goal Part Project Modify Stort Program Compile Tasing Gnu C Compiler Goc Run Program Q43993607 . . .

HWI: The goal of this part of the project is to modify a stort program, compile it tasing the GNU C Compiler goc, and run it. A program shell *1-2-shell.c is provided. You must copy/rename it to 1-2.c and modify it to compute the following. The shell program has a global variables which is initialized with a hexadecimal number. Modify the program to determine whether x is a Harshad number in base 16 and if so, whether the factors involved are mirrors of each other in base 16). Recall that a 16-Harshad number is a positive integer that is divisible by the sum of its digits when written in base 16. In other words, your program should determine if x = pec, where p is the sum of hexadecimal digits of , and has the same digits as pin reverse order. An example of such a mumber is 0x6A5. In base 16, 6+A+5 = 15 which evenly divides 0x6A5. So Ox6A5 is a 16-Harshad number and its factors (Ox6A515 Example 0x613: 6+A+3 = 13; 0x643/13 has a remainder 0x6A4 = 14 * 55 Ox6A5 = 15 51 Result (1 of 3 cases): not a 16-Harshad number (case ) 16-Harshad w/out mirror factors (case 2) 16-Harshad w mirror factors (case 3) Your program should indicate which case is true for any given x, using one of the 3 possible print statements provided in the shell code. Be sure to try multiple test cases, but please return x to the original test value when submitting your code. Here are some other numbers to try: Ox1AAF, Ox1ASF, OxE29, 0x1B00, Ox1D2F, Ox1A90, OxE30. Compiling and running your code: You should open a “terminal window” to nm gccunder Limx/Unix (type man gecfor compiler usage or look up GCC online documentation on the intemet). If you do not have gec installed, you can use “sudo apt-get install gcc to install it. See these links for quick tutorials on apt-get and installing packages • https://www.howtogeek.com/261449/how-to-install-linux-software-in-windows-10s-ubunta-bash-shell • www.howtogeek.com/63997/how-to-install-programs-in-ubuntu-in-the-command-line Note that in the terminal window, you can enter any of the Linux commands (such as ls. cd. cp; for reference see http://ece2035.ece.gatech.edu/assignments/Linux Cmd Cheatsheet.pdf Use the Linux command cd to change your current working directory to the directory in which you placed the shell program For example, > cd /Documents/2035/hwl or > cd /mnt/c/Users/GBurde11/2035/hwl You can list the files in that directory using > ls -la You can copy a file using cpor rename a file using mv(move a file to a new file). For example: > cp HW1-2-shell.c HW1-2.c Using the ascii text editor of your choice modify the HH1-2.cprogram to compute the span as descnbed above. Once you write your program you can compile and run it using the Limx command line: > gcc HW.-2.c -g -Wall – HW1-2 > ./HW1-2 You should become familiar with the compiler options specified by these flags. Show transcribed image text HWI: The goal of this part of the project is to modify a stort program, compile it tasing the GNU C Compiler goc, and run it. A program shell *1-2-shell.c is provided. You must copy/rename it to 1-2.c and modify it to compute the following. The shell program has a global variables which is initialized with a hexadecimal number. Modify the program to determine whether x is a Harshad number in base 16 and if so, whether the factors involved are mirrors of each other in base 16). Recall that a 16-Harshad number is a positive integer that is divisible by the sum of its digits when written in base 16. In other words, your program should determine if x = pec, where p is the sum of hexadecimal digits of , and has the same digits as pin reverse order. An example of such a mumber is 0x6A5. In base 16, 6+A+5 = 15 which evenly divides 0x6A5. So Ox6A5 is a 16-Harshad number and its factors (Ox6A515 Example 0x613: 6+A+3 = 13; 0x643/13 has a remainder 0x6A4 = 14 * 55 Ox6A5 = 15 51 Result (1 of 3 cases): not a 16-Harshad number (case ) 16-Harshad w/out mirror factors (case 2) 16-Harshad w mirror factors (case 3) Your program should indicate which case is true for any given x, using one of the 3 possible print statements provided in the shell code. Be sure to try multiple test cases, but please return x to the original test value when submitting your code. Here are some other numbers to try: Ox1AAF, Ox1ASF, OxE29, 0x1B00, Ox1D2F, Ox1A90, OxE30. Compiling and running your code: You should open a “terminal window” to nm gccunder Limx/Unix (type man gecfor compiler usage or look up GCC online documentation on the intemet). If you do not have gec installed, you can use “sudo apt-get install gcc to install it. See these links for quick tutorials on apt-get and installing packages • https://www.howtogeek.com/261449/how-to-install-linux-software-in-windows-10s-ubunta-bash-shell • www.howtogeek.com/63997/how-to-install-programs-in-ubuntu-in-the-command-line Note that in the terminal window, you can enter any of the Linux commands (such as ls. cd. cp; for reference see http://ece2035.ece.gatech.edu/assignments/Linux Cmd Cheatsheet.pdf Use the Linux command cd to change your current working directory to the directory in which you placed the shell program For example, > cd /Documents/2035/hwl or > cd /mnt/c/Users/GBurde11/2035/hwl You can list the files in that directory using > ls -la You can copy a file using cpor rename a file using mv(move a file to a new file). For example: > cp HW1-2-shell.c HW1-2.c Using the ascii text editor of your choice modify the HH1-2.cprogram to compute the span as descnbed above. Once you write your program you can compile and run it using the Limx command line: > gcc HW.-2.c -g -Wall – HW1-2 > ./HW1-2 You should become familiar with the compiler options specified by these flags.
Expert Answer
Answer to HWI: The goal of this part of the project is to modify a stort program, compile it tasing the GNU C Compiler goc, and ru…
OR