A meticulous programmer determined that 109 is the largest p

A meticulous programmer determined that 10^9 is the largest power of ten that will fit in a word binary integer, and wanted to define a constant of that value. To ensure that he wrote the constant with the correct number of zeros, he wrote the statement TEN_to_9 DC F\'1,000,000,000\' What would be generated? What would you recommend?

Solution

int ispoweroftwo(insigned int x)

{

unsigned int numberofzeros=0;

while(x&&numberofzeros<=1)

{

if((x&1)==0)

numberofzeros++;

x>>=1;

}

return (numberofzeros==1);

}

 A meticulous programmer determined that 10^9 is the largest power of ten that will fit in a word binary integer, and wanted to define a constant of that value.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site