subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:10
Type the correct answer in the box. spell all words correctly. which technology should andrea use? andrea owns a potato chips manufacturing unit. she has been getting complaints about the quality of the chips. she knows her product is good. she realizes that she needs to change the way the chips are packaged. she should use technology, which uses gases, such as carbon dioxide or argon, to create an air cushion, which improves the shelf life of products.
Answers: 2
question
Computers and Technology, 21.06.2019 17:30
How many pairs of chromosomes do human body cells contain?
Answers: 2
question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
You know the right answer?
Implement function bin2dec that takes a binary number bin_num as a string argument and prints out th...
Questions
question
Mathematics, 23.04.2020 21:12
question
Chemistry, 23.04.2020 21:12
question
Mathematics, 23.04.2020 21:12
Questions on the website: 13722367