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]
3 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]3 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
Who is the father of computer?​
bagirrra123 [75]

Answer:

The first automatic digital computer has been designed by the English mathematician and inventor Charles Babbage. Babbage developed the Analytical Engine Plans for the mid-1830s.

Explanation:

  • Babbage has developed the concept of a digital, programmable computer and was a mathematician, philosopher, inventor, and mechanical engineer.
  • Some regard Babbage as a "computer father"
  • The inventing of its first mechanical computer, the difference engine, is attributable to Babbage, which eventually resulted in more complex electronic designs, although Babbage's Analytical Engine is the main source of ideas for modern computers. He was described as the "prime" among the numerous polymaths of his century by his varied work in another field.
7 0
3 years ago
____ allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing
Sphinxa [80]
It is the internet callback technology that allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing. It is a technology that enable one to browse the Internet to cue on a certain website to have a representative call a certain number.<span />
6 0
3 years ago
Read 2 more answers
Which is a requirement for searching for a template
Lina20 [59]

Answer:

umm... you did not discribe the anwsers, i cannot help you

8 0
3 years ago
Draw a flow chart except the principle, time and date from the user. and display the simple interest and amount as output.​
timama [110]

Answer:

See attachment for flowchart

Explanation:

The explanation is as follows

1. Start

2. Get input for principal, time and rate

3. Calculate Interest using Interest = Principal * Rate * Time/100

4. Print Interest

5. Stop

7 0
3 years ago
Explain why computer systems utilize digital instead of analog signals
KiRa [710]
Analog signals are MUCH harder to determine a discreet value from. By nature, analog's voltages just kind of flow into each other. Digital is very simple: voltage and it's on, logical one; no voltage, it's off, logical zero.
4 0
3 years ago
Other questions:
  • If you’d like to have multiple italicized words in your document, how would you change the font of each of these words?
    12·2 answers
  • Explain free space allocation?
    9·1 answer
  • Which feature of a browser will you select to block pop-ups? view help tools file
    15·2 answers
  • Write a method named lastFirst that accepts a string as its parameter representing a person's first and last name. The method sh
    13·1 answer
  • (tco 3) what vbscript boolean operator could be used to replace the nested selection structure in this pseudocode? if empmedical
    13·1 answer
  • Renting provides _________ flexibility but can lead to _________ costs in the long-term.
    14·2 answers
  • Computer-generated random numbers are normally distributed. true or false
    11·1 answer
  • A two-dimensional array has been defined to hold the quantity of each of 5 different healthy snack products sold in a tuckshop d
    10·1 answer
  • Gavin is making a new logo for his business. He uses drawing software to create a unique. Which file format does he use to creat
    5·1 answer
  • Difference between tell() and seek().​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!