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
If an employee who needs eye protection wears prescription lenses he or she should
gogolik [260]
Wear Regular glasses not contacts.
5 0
3 years ago
Steve is happy today but he ____ yesterday​
suter [353]

steve is happy today but he wasn't yesterday

3 0
2 years ago
Read 2 more answers
HTML question please help
Pie

Answer:

background-color: (Color)

Explanation:

This is actually CSS coding, as you would code it like:

Body {

background-color: (Color)

}

5 0
3 years ago
What is cloud storage?​
Aleks [24]

Cloud storage is a service model in which data is maintained, managed, backed up remotely and made available to users over a network (typically the Internet).

3 0
3 years ago
TVBCA has just occupied an old historic building in downtown Pittsburgh in which 15 employees will work.
7nadin3 [17]

Answer:

A. The proposed solution delivers the required result and both optional desired results.

Explanation:

The IEEE 802.11a is the standard code of the wireless communication technology known as WIFI, it is wireless as it requires no cable to connect to a network device. The data transmission rate of the IEEE 802.11a is 1.5 - 54Mbps (mega bit per second). So, the employees in the TVBCA building can wireless connect to the network, which allows them to be mobile and they can also send large CAD files among themselves.

6 0
3 years ago
Other questions:
  • What is the input output ratio if its 12/23
    7·1 answer
  • The following method public String removeFromString(String old, String frag) removes all occurences of the string frag from the
    12·1 answer
  • Mia is attending a team meeting to discuss how to prevent accidents. One of her teammates suggests pushing all the desks against
    15·2 answers
  • Who is the CEO of Quora?
    15·1 answer
  • Which of the following is a popular open source intrusion detection system that runs on SmoothWall?? Synchronous Dynamic Random
    6·1 answer
  • How does the binary numbering system differ from the hexadecimal numbering system?
    14·2 answers
  • Julie is trying to decide weather or not to add a color scheme to her presentation and she asks you for your advice u should adv
    9·1 answer
  • Computer science practical on VB.NET. program 1. program to find the square of a number. write the code achieve it​
    6·1 answer
  • True or false altering iso will affect the area of focus in a photo
    13·1 answer
  • Which of the following is true about named ranges?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!