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
Mariulka [41]
3 years ago
13

Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar

y. 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:
mylen [45]3 years ago
3 0

Answer:

The program to this question can be described as follows:

Program:

num= int(input('Enter a number: ')) #input value by user

st = '' #defining string variable

while num > 0: #define loop to calculte values binary number

   val= num % 2 # holding remainder (0 or 1) in val variable

   st =st+str(val) # store value in str variable

   num = num//2 #calculte quotient value

print("binary number is: ",st)

Output:

Enter a number: 5

binary number is:  101

Explanation:

Program description as follows:

Firstly the "num" variable is declared, for user input, then an "st" variable is declared, to calculates user input value binary number.

In the next step, a while loop is declared, inside the loop, another variable "Val" is declared, that holds value remainders, which is added on the "st" variable.

Outside the loop, the print method is used, that prints st variable holds value.

You might be interested in
18. Which type of briefing is delivered to individual resources or crews who are assigned to operational tasks and/or work at or
GrogVix [38]

Answer: Field-level briefing

Explanation: Field-level briefing is the brief description that is provided to the crew members or operation task holders.This briefing contains the information about the work and operation that are to be followed by the workers on the site .

Field level briefing is sort of instructions to individual or group of people who will be working with their assigned duties on the incident site.

8 0
3 years ago
_________ is a society organized with the purpose of rendering service to its members and to the public in general.
sesenic [268]

Answer:

cooperate society

Explanation:

A cooperative society is a voluntary association that started with the aim of the service of its members.

8 0
2 years ago
How were images captured before the invention of the camera?
xeze [42]

Answer:

The British inventor Fox Talbot produced his first successful photographic images in 1834, without a camera, by placing objects onto paper brushed with light-sensitive silver chloride, which he then exposed to sunlight.

Explanation:

5 0
2 years ago
One or more messages about the same topic is a ?
elena55 [62]

Answer:

This is the case of redundancy or the repeated data. It means that the same data is being repeated again and again. And its the wastage of time and memory both. The redundancy must be removed in all circumstances. However, we cannot as without it proper normalization of data is not possible.

Explanation:

The answer is self explanatory.

6 0
3 years ago
What is communication​
IgorLugansk [536]

Answer:

it is when u talk to someone

6 0
3 years ago
Read 2 more answers
Other questions:
  • Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation
    6·1 answer
  • Approximately what percent of desktop PCs are used for work-related purposes?
    13·2 answers
  • Question Workspace Check My Work Copying computer software, video games, movies, or music without paying the producer for them i
    11·1 answer
  • Create a Produceclass that hasan instance variable of type Stringfor the name, appropriate constructors, appropriate accessor an
    13·1 answer
  • What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary se
    13·1 answer
  • To use   ( 2 complement ) answer it (101101)2 – (1100)2 =   (                    )2
    12·1 answer
  • True or False. A geosynchronous satellite changes its area in the sky each day.
    5·2 answers
  • Classify the various scenarios in a web development team that is creating a website for a client according to the priority level
    9·1 answer
  • 6.What does transgenic mean?​
    12·2 answers
  • Help101111 avatar can we be friend's please? My name is Keegan. what is yours?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!