1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Rama09 [41]
4 years ago
15

Write a program that reads a number and prints all of its binary digits: print the remainder number % 2, then replace the number

with number / 2. keep going until the number is 0. for example, if the user provides the input 13, the output should be
Computers and Technology
1 answer:
allsm [11]4 years ago
5 0
If you print the binary digits just like that, they'll be in the wrong order (lsb to msb). Below program uses recursion to print the digits msb to lsb. Just for fun.

void printBits(unsigned int n)
{
   if (n > 1) {
      printBits(n >> 1);
   }
   printf((n & 1) ? "1" : "0");
}

int main()
{
   unsigned int number;
   printf("Enter an integer number: ");
   scanf_s("%d", &number);
   printBits(number);
}

You might be interested in
To add a hyperlink to your presentation, select the text, choose Hyperlink from the Insert menu, and then
Elan Coil [88]

Answer:

I guessed D, taking it right now, sorry if it's wrong

Explanation:

6 0
3 years ago
Consider the following code: <br> x=9 y = -2 z=2<br> print (x + y * z)<br> What is output?
Goryan [66]

Answer:

14

Explanation: The reason why is because adding a negative is pretty much subtracting by 2. 9-2=7. Then multiply 7 by 2 like add 7 to 7 and you get 14.

3 0
4 years ago
A virus that propagates using the internet or another computer network is called __________.
olasank [31]
This is called a worm
8 0
3 years ago
4) To run program short cut​
quester [9]

Answer:

Run Dialog

Open it by pressing WinKey+R. In the Run dialog, type the name of a program's .exe file and press Enter to launch it.

Explanation:

Please give me brainlist and follow

6 0
3 years ago
Ms word
goldenfox [79]
  1. Answer:

I have no idea about this worksir

Explanation:

ok sir I dont know sfe

6 0
3 years ago
Other questions:
  • Common icons found on the Windows desktop are _____.
    6·2 answers
  • Which magazine can help public determine best technology to buy
    12·1 answer
  • Identify the data set level of measurement for the following: individual tax filing status (single, head of household, widowed,
    8·1 answer
  • Practice problems on functions. Write C function(s) to carry out the specified tasks. For each problem, also write the suggested
    15·1 answer
  • Please create C program, the task is to implement a function edoublepowerx that has an input parameter x of floating-point value
    11·1 answer
  • What would be an ideal scenario for using edge computing solutions?
    10·1 answer
  • Why isn't image display working on wacom tablet.
    8·1 answer
  • At a red traffic light, you must stop__
    12·2 answers
  • Please help me on this match all this up i’ll give you brainlist
    13·2 answers
  • Enabling encryption of all data on a desktop or laptop computer is generally considered:______.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!