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
Which of the following URL extensions indicate the website is used by a college or university?
Svetllana [295]
The answer is (D) - .edu
4 0
3 years ago
Read 2 more answers
Engine coolant does all of the following except
Amiraneli [1.4K]
D prevent the formation of rust
8 0
3 years ago
Read 2 more answers
I NEED HELP!! What is the portrait mode?
Rashid [163]

Answer:

A its achromatically save your file

5 0
2 years ago
Read 2 more answers
which software application offers a variety of templates for creating reports, flyers and newsletters that you can access within
sp2606 [1]
Presentation Softwares
4 0
3 years ago
The Adaptive Software Development (ASD) life cycle model assumes that software development follows an adaptive approach because
allsm [11]

Answer: ....

false

Explanation:

Adaptive Software Development (ASD) is a direct outgrowth of an earlier agile framework, Rapid Application Development (RAD). It aims to enable teams to quickly and effectively adapt to changing requirements or market needs by evolving their products with lightweight planning and continuous learning.

The Adaptive Software Development (ASD) life cycle model assumes that software development follows an adaptive approach because the requirements cannot be clearly expressed early in the life cycle. it refers to a problem-solving approach that requires defining the scope of a system, dividing it into its components, and then identifying and evaluating its problems, opportunities, constraints, and needs.

7 0
2 years ago
Other questions:
  • Add the following functions to the code:
    9·1 answer
  • You discover memory is corrupted, what would be an indication of a software vs. a hardware issue?
    5·1 answer
  • What shortcut bring up the print page
    8·2 answers
  • This type of method method performs a task and sends a value back to the code that called it:
    5·1 answer
  • Help ASAP
    5·2 answers
  • You can use pen and highlighter tools to emphasize information on a slide during a PowerPoint presentation. These tools are avai
    11·1 answer
  • Provide instance fields for title, month, and year (for example, "Scientific American", "April", 2020). Each of these should be
    13·1 answer
  • AWT
    7·1 answer
  • What effect does social media have on teens?
    10·2 answers
  • We investigated a program which is probably used as one component of a bigger password breaking algorithm. We determined that th
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!