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
What are 6 steps to take to figure out what's wrong with your computer?
lisabon 2012 [21]

Answer

  1. located the problem
  2. Go to system settings
  3. Try to uninstall and install the program
  4. Try troubleshooting the program
  5. Try contacting the device admin
  6. Read the user Manuel before try to do anything on the system
6 0
4 years ago
The __________ utility has the capability to manage users, create and administer user groups, and apply user rights to those use
ella [17]

Answer:

Active Directory Users and Computers

Explanation:

Active Directory Users and Computers is a term that describes Microsoft Management Console that is utilized in conducting and managing Active Directory, the objects; which comprises of the users and computers, the Organizational Units, together with their characteristics.

Hence, the Active Directory Users and Computers utility has the capability to manage users, create and administer user groups, and apply user rights to those users and groups.

6 0
3 years ago
How do l write a program which countdown from 10 to 3​
earnstyle [38]

Answer:

use loop

for(int i =10;i>2; i--)

{

System.out.println(i+"\n")

}

4 0
3 years ago
In a dark place you have only a match , a twig , campfire logs , and oil lamp and a candle which do you literally first /
ohaa [14]

Answer:

You would use a twig first :)

Explanation:

3 0
3 years ago
Which categories format cells
fredd [130]
Currency, percentage, date, time, fraction, scientific
4 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that prompts the user to enter an equation in the form of 10 5, or 10-5, or 1*5, or 13/4, or 13%4. The program s
    6·1 answer
  • What does ADSL stand for?
    6·2 answers
  • How does an ALU perform logical operations?
    6·1 answer
  • Can somebody help me with this problem
    10·1 answer
  • Hi i need to know how much watt hours divided by month total
    14·1 answer
  • SONET: is a standard for optical transmission that currently operates at Terabit per second speeds is almost identical to the IT
    7·1 answer
  • Which tabs are expandable and collapsible? This would be in word 2010
    6·1 answer
  • In the negative side of the battery, there are millions and millions of _________.
    14·1 answer
  • How to start the ms excel​
    10·1 answer
  • WHO WANT P O I N T S.................................................
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!