Computers and Technology

Implement function bin2dec that takes a binary number bin_num as a string argument and prints out the corresponding decimal number. 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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:30, porkhappycom
Which number on the image above correctly indicates the name of a folder in this url? a.1b.2c.3d.4
Answers: 2
image
Computers and Technology, 22.06.2019 14:30, SKYBLUE1015
What percentage of companies is projected to use social media to locate new employees in 2012
Answers: 2
image
Computers and Technology, 23.06.2019 13:30, gamingisfun
Me ! evelyn is a manager in a retail unit. she wants to prepare a report on the projected profit for the next year. which function can she use? a. pmt b. round c. division d. what-if analysis
Answers: 2
image
Computers and Technology, 23.06.2019 20:30, batmandillon21
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
Do you know the correct answer?
Implement function bin2dec that takes a binary number bin_num as a string argument and prints out th...

Questions in other subjects:

Konu
Arts, 25.11.2020 01:20
Konu
Arts, 25.11.2020 01:20
Konu
Mathematics, 25.11.2020 01:20