Question: In C language The problem to be solved by this program is to input an integer, calculate the factorial of that integer and output the

 In C language The problem to be solved by this programis to input an integer, calculate the factorial of that integer and

In C language

The problem to be solved by this program is to input an integer, calculate the factorial of that integer and output the result in decimal and binary. There is a qualifier, the individual bits of the binary form must be each stored into a separate element of an array. A sample execution of a program that follows the specifications is: FACTORIAL & BIT TESTER Input a positive integer value between 0 and 65535 ==> 7 7 Factorial = 5040 or 0x1350 or 0b0001001110110000 Do another (y)? y Input a positive integer value between 0 and 65535 ==> 12 12 Factorial = 64512 or Oxfc00 or 0b1111110000000000 Notice that the hexadecimal output is optional and not described in the specifications below. Since the integers used throughout this assignment are unsigned short, which are 16 bits wide, it will be convenient to have the following constant defined using the pre-processor: # define SIZE_INT 16 Write a function that accepts an array of unsigned char sized integers describing an integer in binary format (each item in the array corresponds to a single bit of the integer) and prints each element of the array as a decimal number. The function prototype (or signature) is: void printBitArray (unsigned char theBits [SIZE INT]); Write a function accepts an unsigned short sized integer value and an array of unsigned char sized integer values. The function places each of the 16 bits of unsigned short integer into different array elements, in the least significant bit location. If, for example, the input integer was 25 ( = 0x0019 = Ob0000000000011001 ) then the array would need to contain: OOOOOOOO0011001 The function prototype (or signature) is: void toBits (unsigned short value, unsigned char inBits (SIZE_INT]); NOTE: While this can be completed using the integer modulus and division operators, more grades will be awarded to code that uses at least 1 bitwise operator and a mask and bit shifting. Write a recursive function that accepts an unsigned short sized integer parameter, calculates and returns the factorial of that value. The return value should also be an unsigned short integer. The function prototype (or signature) is: unsigned short factorial (unsigned short num); Write a main function that, inputs an integer number (of size unsigned short), calculates the factorial of that number, uses toBits to place the 16 bits of the result into 16 separate locations of a byte sized integer array, and then uses printBits to output the contents of that array. Finally, the program should give the user the option of re-running with different input

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!