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
Choose three typical responses for the Host utility, and explain what they indicate.
Karo-lina-s [1.5K]

Answer:

Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.

Explanation:

7 0
2 years ago
If you paste a word document text into an excel spreadsheet, the paste optio allow you to keep source formatting or
castortr0y [4]
I think the answer is c
6 0
3 years ago
Define a lambda function that accepts one argument (a list of strings) and returns a list of only the words that start with an '
Grace [21]

Answer:

  1. def Lambda(strList):
  2.    return list(filter(lambda s: (s.startswith("e")), strList))
  3. print(Lambda(["meaning", "cart", "engine", "egg"]))

Explanation:

The solution code is written in Python 3.

Lambda function is an anonymous function. It is a function without any name and it is started with keyword lambda. To write a lambda function to filter the string started with an 'e', we can write a lambda expression, s.startswith("e") that work on one input strList. If any word from strList started with letter "e", the word will be added into a list generated by filter function. At the end, the Lambda function will return the list of strings as output.

When we test the Lambda function using the sample string list (Line 4), we shall get ['engine', 'egg'] printed to terminal.

8 0
3 years ago
Describe all the main stress causal agents​
LekaFEV [45]

Answer:

Causes of Stress

Being unhappy in your job.

Having a heavy workload or too much responsibility.

Working long hours.

Having poor management, unclear expectations of your work, or no say in the decision-making process.

Working under dangerous conditions.

Being insecure about your chance for advancement or risk of termination.

5 0
3 years ago
True or false? any webb app can be accessed and run on any computing
Mademuasel [1]

Answer:

B. False

Explanation:

A web application is a computer program that  works over the internet. So, in order to access and run it you need a web browser and this will also require to have an internet access. If you don't have one of these you will not be able to run the app.

6 0
3 years ago
Other questions:
  • Linguist study
    9·1 answer
  • Why is the stateless nature of the internet a problem for shopping cart software? g?
    5·2 answers
  • In 125 words describe the steps to active listening.
    6·1 answer
  • An IT technician has manually configured an IP address on a laptop for a new employee. Each time the employee tries to connect t
    10·1 answer
  • Suppose that f() is a function with a prototype like this: void f(________ head_ptr); // Precondition: head_ptr is a head pointe
    15·1 answer
  • Which type of choir often sings AND dances while they perform?
    9·1 answer
  • Your network has been having problems lately when users are participating in video conferences - the video and audio stutters ve
    13·1 answer
  • A network technician attempts to ping www.example.net from a customer computer, but the ping fails. access to mapped network dri
    5·1 answer
  • PLEASE ANSWER AND HURRY I'LL MARK YOU BRAINLIEST!!<br><br><br>​
    9·1 answer
  • Which type of measurement would you use to determine the mass of sugar?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!