Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following program uses function multiple to determine if the integer entered

ID: 3820670 • Letter: T

Question

The following program uses function multiple to determine if the integer entered from the keyboard is a multiple of some integer X. Examine the function multiple, then determine X's value. Make sure you test the code with your compiler.//exl0_16.c//This program determines whether a value is a multiple of X. #include sint multiple(int num);//prototype int main(void) {int y;//y will hold an integer entered by the user putsC "Enter an integer between 1 and 32000: "); scanf(, &y;);//if y is a multiple of X if (multiple(y)) {printfC d is a multiple of X ", y);}//end if else {printfC, , pod is not a multiple of X ", y);}//end else}//end main//determine whether num is a multiple of X int multipleC int num) {int i;//counter int mask =//initialize mask int mult =;//initialize mult for (i = 1; i

Explanation / Answer

Ths program is finding multiple of 1024

This is revealed by mask <<= 1, basically this is shifting mask 10 times and seeing if bits in num is same as mask, if yes its a multiple.

(Nice question)