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
Savatey [412]
2 years ago
9

Implement function bin2dec that takes a binary number bin_num as a string argument and prints out the corresponding decimal numb

er. Each char in the string has a value of either '0' or '1' to represent a bit. The string does not have any leading space. For example, function call bin2dec("1011") should print 11. You can assume that bin_num can have up to 32 bits. To convert a char in the binary number string to an int, you can subtract the char by '0'. For example, you can use bin_num[0] - '0' to get the int value of the most significant bit of the binary number. Restriction: printf is the ONLY C library function that you can use in the implementation.
Computers and Technology
1 answer:
andriy [413]2 years ago
7 0

Answer:

See explaination

Explanation:

void bin2dec(char *s) {

int i = 0, num = 0;

while (s[i]) {

num *= 2;

num += s[i] - '0';

i++;

}

printf("%d\n", num);

}

The program Implement function bin2dec that takes a binary number bin_num as a string argument and prints out the corresponding decimal number.

You might be interested in
What are the factors that affect self-confidence?
denis-greek [22]

Answer:

The factors that affect self confidence are not having enough faith in yourself and letting what others say about you put you down

Explanation:

Plz mark brainlest it will help me so much

5 0
2 years ago
An output device is any device that displays, prints, or plays content stored on a computer. from the list below, identify the d
inysia [295]
Answer is C = Speaker

How? as the speaker is the only item on the list that displays any type of content, that being audio, it's the only feasible answer to this question.
3 0
3 years ago
I need help with this problem please
alina1380 [7]

Answer:

i think its d

8 0
2 years ago
After machine language, what is the next most basic type of programming language, which still uses many length strings of numera
solniwko [45]
Basic would be the most basic lanauge. It was created in M.I.T. and was one of the first programming lanauges.
7 0
2 years ago
Which of the following is a Layer 3 protocol designed to permit routers to exchange information about networks that are reachabl
Nikolay [14]

Answer:

a. Routing protocol

Explanation

Routing protocol is a layer 3 (Network layer) protocol used by routers to exchange information about available routes , their associated costs and delays.

5 0
3 years ago
Read 2 more answers
Other questions:
  • My home PC has IP address 192.168.1.22 and connects to the Internet through a NAT router. Assume I am downloading a web page fro
    5·1 answer
  • Not providing guarding or fall protection for workers on a 25-foot scaffold. The resulting fall would most likely end in death,
    6·1 answer
  • File Explorer contains ribbon tabs that can be used for various functions. Which ribbon tab provides options to open a new File
    11·1 answer
  • What is a IT form? any help would be great thnx
    14·2 answers
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
  • When an expression containing a ____ is part of an if statement, the assignment is illegal.
    14·2 answers
  • How many pounds must a sand bag weigh to test if a safety net can absorb the proper amount of force? A. 150 lbs. B. 200 lbs. C.
    6·1 answer
  • While (e &lt; 10):<br> print (c)
    10·1 answer
  • MORE FREEE POINTS AYEEE
    7·2 answers
  • I need help with my work
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!