Question: For this problem, you must show each conversion by hand ( you may use Excel, but don't have to ) from problem 2 - 6

For this problem, you must show each conversion by hand (you may use Excel, but don't have to) from problem 2-6
followed by the program output of that respective value. Please display the program outputs and comment where you inserted the number.
2-6
(.2) Convert the following 8-bit numbers to decimal by hand:
a)10101010 b)01010101 c)11110000 d)00001111 e)10000000 f)01100011 g)01111011 h)
11111111
#include
int main(void)
{
int x;
unsigned int y;
while (1)// bad programming
{
printf("Enter a decimal integer (0 to quit): ");
scanf_s("%i", &x);
if (x ==0) break;
printf("Enter a bit pattern in hexadecimal (0 to quit): ");
scanf_s("%x", &y);
if (y ==0) break;
printf("%i is stored as %#010x, and
", x, x);
printf("%#010x represents the decimal integer %i
", y, y);
}
printf("End of program.
");
return 0;
}
For this problem, you must show each conversion

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 Programming Questions!