Question: Fill the missing information (shown as ________) in the program so that it can compute and display the 8-bit binary of 223, which is 11011111.
Fill the missing information (shown as ________) in the program so that it can compute and display the 8-bit binary of 223, which is 11011111. Following are the steps shown as an example for the given code for converting a decimal number say 11 into 4-bit binary.
11/8 = Quotient = 1, Remainder = 3
3/4 = Quotient = 0, Remainder = 3
3/2 = Quotient = 1, Remainder = 1
1/1 = Quotient = 1, Remainder = 0
So, 11 = 1 0 1 1
#include
using namespace std;
int main() {
int num = 223, div = 128;
int _____________ ; // 1. Fill in here.
while(div ____ 1){ // 2. Fill in here.
digit = num / ___; // 3. Fill in here.
cout << ________; // 4. Fill in here.
num = num % ___ ; // 5. Fill in here.
div = div/2;
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
