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
Nezavi [6.7K]
3 years ago
12

8.10 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's a

nd 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x
Computers and Technology
1 answer:
Korvikt [17]3 years ago
3 0

Answer:

// This program is written in C++ programming language

// Comments are used for explanatory purpose

// Program starts here

#include <iostream>

#include <string>

using namespace std;

// Declare variables

int inputvar;

// Declare output variable as array

int outputvar[32];

// Set a counter for binary array

int i = 0;

while (inputvar > 0) {

// Divide inputvar by 2 and store remainder in outputvar

outputvar[i] = n % 2;

inputvar/=2;

i++; // increment i by 1

}

// End of division

// Prin resulting array in reverse order

for (int j = i - 1; j >= 0; j--) {

cout << outputvar[j];

}

return 0;

}

// End of Program

You might be interested in
. the web is based on the ________ protocol
elena55 [62]
The standard (and default) port for HTTP<span> servers to listen on is 80, though they can use any port. </span>HTTP<span> is based on the </span>TCP/IP protocols<span>, and is used commonly on the Internet for transmitting web-pages from servers to browsers.</span>
3 0
3 years ago
What is the diffrence between the the grassland and the savanna biomes
sergey [27]

Answer:

The term "savanna" is often used to refer to open grassland with some tree cover, while "grassland" refers to a grassy ecosystem with little or no tree cover.

Explanation:

5 0
3 years ago
Read 2 more answers
The common channel signaling (CCS) system provides a separate network dedicated to control and signaling over the PSTN. This ena
dezoksy [38]
The correct answer is A.True
8 0
3 years ago
A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
kati45 [8]

Explanation:

Let the size of a large server be L, and

the size of a small server be S.

We are given two scenarios,

2L+4S = 64.............(1)

and

L+3S = 40...............(2)

We solve the equations as follows

2(2)-(1)

2L-2L +6S-4S = 2*40-64

2S = 16

so S=8 ..................(3), size of small server

substitute (3) in (2)

L+3(8) =40

L = 40-24 = 16..............size of large server

8 0
3 years ago
You typed the word "weather" when you meant to type the word "whether." When will Writer or Word flag this as a misspelling or a
maria [59]

Answer:

It depends on the structure of the sentence.

Explanation:

This will be shown as grammatical mistake because both the spellings are correct. If we write the word weather instead of the whether, Ms word shows the grammatical mistake. This is because, if we want to write the word whether, we should use or in our sentence. Both of these words are comes together.

Example

I will take a leave whether its raining or not.

In above sentence, both whether and or comes together. If we write weather instead of whether it just show the grammatical mistake in the sentence.

4 0
3 years ago
Read 2 more answers
Other questions:
  • We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac
    11·1 answer
  • What coding scheme is used by most microcomputers?
    11·1 answer
  • After clicking the Start button on your computer screen desktop, what option would you then select to examine system components
    10·2 answers
  • Which of the following is not an example of technological progress? A: new scientific knowledge that has practical applications
    12·2 answers
  • Omar wants to know how his organization has been doing financially over the last year. He wants to also compare this information
    5·2 answers
  • A package delivery company or a cell phone company wouldn't go far if it could not deliver products smoothly and reliably. This
    15·1 answer
  • Listening to music on giggl, join!<br><br> link will be in comments, copy and paste
    9·2 answers
  • A chemical mixture that is burned to produce thrust. (Jet engine homework)
    14·2 answers
  • Question # 5
    6·1 answer
  • When you run your Windows Form application, what is the lifespan of a global variable (also known as a "field" or "class" variab
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!