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
nadezda [96]
3 years ago
8

write a c++ program that reads from the user a positive integer (in a decimal representation), and prints its binary (base 2) re

presentation. Your program should interact with the user exactly as it shows in the following example: Enter decimal number: 76 The binary representation of 76 is 1001100
Computers and Technology
1 answer:
Vesna [10]3 years ago
5 0

Answer:

The program to this question can be described as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int x1,rem,i=1; //defining integer variable

long Num=0;// defining long variable

cout << "Input a decimal number: "; // print message

cin >> x1; //input value by user

while (x1!=0) //loop for calculate binary number

{

//calculating binary value    

rem= x1%2;

x1=x1/2;

Num =Num +rem*i;//holding calculate value

i=i*10;

}

cout <<Num;//print value

return 0;

}

Output:

Input a decimal number: 76

1001100

Explanation:

In the above code, four variable "x1, rem, i, and Num" is declared, in which three "x1, rem, and i" is an integer variable, and one "Num" is a long variable.

  • In the x1 variable, we take input by the user and use the while loop to calculate its binary number.
  • In the loop, first, we check x1 variable value is not equal to 0, inside we calculate it binary number that store in long "Num" variable, after calculating its binary number the print method "cout" is used to prints its value.  
You might be interested in
You already know how to use lists. What is the index of 5 in the following list?
otez555 [7]
The answer is 1, the 3rd circle
5 0
3 years ago
PLZ HELP ME I WILL GIVE BRAINLIST!!! Why was the Internet originally constructed?
pochemuha

Answer:

C. to provide online search capabilities

Explanation:

The first workable prototype of the Internet came in the late 1960s with the creation of ARPANET, or the Advanced Research Projects Agency Network. Originally funded by the U.S. Department of Defense, ARPANET used packet switching to allow multiple computers to communicate on a single network.

5 0
2 years ago
______was developed as an interim management protocol with OSI as the ultimate network management protocol.
RSB [31]

Answer:

Simple Network Management Protocol

Explanation:

Simple Network Management Protocol otherwise referred to as SNMP is a form of computer protocol that is mainly used in obtaining and regulating information relating to connected gadgets. It is practically based on the internet and was originally planned as an interim protocol.

Hence, it can be concluded that the Simple Network Management Protocol was developed as an interim management protocol with OSI as the ultimate network management protocol.

4 0
3 years ago
"In about 100 words, describe the idea behind software as a service (SaaS). In your answer, include at least three examples of e
Mama L [17]

Answer:

Explanation:

Saas refers to software as a service and can also be called software on demand .

It Isa software that is deployed over the internet rather than requiring to install an application .It offers different devices such as pay as you go , subscription model and service on demand model .

Only a compatible browser is needed to access the software .

Electronic packages or components that aree offered as an Saas

1)Shopify

2)Big commerce

3)Slack

3 0
3 years ago
How to reload ingenuity when a pulsating blue thing is there
Hatshy [7]
Todo is very important
4 0
3 years ago
Other questions:
  • Write a program that assigns two integer values from standard input to the variables int1 and int2, then prints "true" if they a
    10·1 answer
  • In most software packages, the function key F1 is used to run the _____program.
    10·1 answer
  • I will upvote....
    10·1 answer
  • The minimum spanning tree of an undirected graph G exists if and only if G is connected. True or False?
    12·1 answer
  • Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent singl
    12·1 answer
  • What does NOT match with Agile Manifesto?
    9·1 answer
  • which of the following devices and and receive information from other device? a parallel port B serial port C video port d both
    8·1 answer
  • What does this map key show
    12·1 answer
  • What are foundations of any game systems that control what the players can or cannot do in the game, as well as the penalties, r
    8·1 answer
  • Why is it essential for every person living in the 21st century to have a computer​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!