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
Which of these files when included in a program will provide user assistance?
olya-2409 [2.1K]
What are the options for this answer? 
8 0
3 years ago
Read 2 more answers
A file to which information is written is referred to as a(n) ____ file.
Iteru [2.4K]
The answer is <span>output.  </span>A file to which information is written is referred to as an output file.  It is  <span>a computer </span>file<span> that contains data that are the </span>output<span> of a device or program. </span>
4 0
2 years ago
This isn't a homework question but rather a technological problem. I connected my device to the motherboard but it will not dete
Helen [10]
Re start the computer again
5 0
3 years ago
Read 2 more answers
you're troubleshooting an ip addressing issue, and you issue a command to view the system's tcp/ip configuration. the command yo
Leviafan [203]

Based on the above, the operating systems the person is  working on is known to be called Linux.

<h3>What is Linux used for?</h3>

Linux is known to be a kind of an open-source Unix-like operating system that is known to be focused on the Linux kernel, which is said to be a kind of an operating system kernel that was said to have been first released on September 17, 1991.

This was released by a man called by Linus Torvalds. Linux is known to be packaged as a form of Linux distribution. It is said to be used as a Server OS made for web servers, it is also used for database servers, file servers, email servers and others.

Therefore, Based on the the given description above, the operating systems the person is  working on is known to be called Linux.

Learn more about Linux from

brainly.com/question/12853667
#SPJ1

You are troubleshooting an IP addressing issue, and so issue a command to view the TCP/IP configuration of the system. The command you use produces the following output:

fxp0: flags=8843&lt;UP, BROADCAST, RUNNING, SIMPLEX, MULTICAST&gt; mtu 1500

inet6 fe80: :2a0:83ff:fe30:57a%fxp0 prefixlen 64 scopeid 0x1

inet 192.168.1.235 netmask 0xfffffx00 broadcast 255.255.255..255

ether 00:a0:83:30:05:7a

media: Ethernet autoselect (100BaseTX &lt;full-duplex&gt;)

status: active

1o0: flags=8049&lt;UP, LOOPBACK, RUNNING, MULTICAST&gt; mtu 16384

inet6 : : 1prefixlen 128

inet6 fe90: : 1%1o0 prefixlen 64 scopeid 0x7

inet 127.0.0.1 netmask 0xff000000

Which of the following operating systems are you working on?

3 0
1 year ago
What sequence is used to create a brochure document from a template?
GenaCL600 [577]

Answer:

computer is used to create a voucher document

6 0
2 years ago
Read 2 more answers
Other questions:
  • describe a real-world scenario where data is collected and needs to be both accurate and precise for the safety of the community
    9·1 answer
  • What is not an option when a user is exporting contacts to share with others?
    10·1 answer
  • Which of the following illustrations is depicted in the icon that's used to access Windows Help and Support files?
    13·1 answer
  • Which of the following statements is correct?
    11·1 answer
  • A short cut to save a file is
    15·1 answer
  • Which of the following is a career that's indirectly linked to careers in web technologies?
    10·1 answer
  • What is wrong with this code and correct it.
    12·1 answer
  • a farmer cultivates 1/4 of his farm with ground nuts and 2/5 of it with maize what is the total landnarea that is cultivated​
    12·1 answer
  • Justine was interested in learning how to play the piano. She has successfully passed every level of music book and is planning
    10·1 answer
  • Describe s computer network that you are familiar with ?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!