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
What is the difference between a workbook and a worksheet?
Snowcat [4.5K]
An Excel worksheet is a single spreadsheet that contains cells organized by rows and columns. A worksheet begins with row number one and column A. Each cell can contain a number, text or formula. A cell can also reference another cell in the same worksheet, the same workbook or a different workbook.
7 0
3 years ago
Read 2 more answers
Why is a class called a factory of objects
zhenek [66]

Explanation:

A class is called an object factory because objects are created from a class. An object is an instance of a class.

4 0
3 years ago
William found out that someone used his report on American culture without his permission. What is William a victim of?
Mnenie [13.5K]

He is a victim of plagiarism.

Plagiarism is when someone steals someone else's work, to help benefit themselves. Taking credit for the other person work.

Hope this helps!

3 0
3 years ago
Read 2 more answers
A _______ is conducted to determine the adequacy of system controls, ensure compliance with established security policy and proc
kow [346]

Answer:

security audit

Explanation:

7 0
3 years ago
Whats an MAR? lolz better not take my points #bonkers
GaryK [48]

Answer:

\huge\mathcal{\fcolorbox{aqua}{azure}{\red{✿ʏᴏᴜʀ- ᴀɴsᴡᴇʀ ♡❖}}}

<em><u>A Medication Administration Record (MAR, or eMAR for electronic versions), commonly referred to as a drug chart, is the report that serves as a legal record of the drugs administered to a patient at a facility by a health care professional. The MAR is a part of a patient's permanent record on their medical chart</u></em>

4 0
2 years ago
Read 2 more answers
Other questions:
  • Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? Ex
    9·1 answer
  • Your desktop computer monitor is not displaying a picture. What would you do to troubleshoot the problem?
    7·2 answers
  • Consider the partially-filled array named a. What does the following loop do? (cin is a Scanner object)int[] a = {1, 3, 7, 0, 0,
    6·1 answer
  • A circuit contains three resistors connected in series. the value of r1 is 150 , the value of r2 is 60 , and the value of r3 is
    8·2 answers
  • If str 1 and str2 are both Strings, which of the following expressions will correctly
    13·1 answer
  • .Ashley is creating a new logo for her client that should be a vector graphic. Which is classified as a vector editing software?
    8·1 answer
  • Using Visio, create a Local Area Network (LAN) consisting of 12 computers, a switch, and three printers. The switch should be in
    11·1 answer
  • It is possible to make the document larger for viewing small text.<br><br> True<br> False
    15·2 answers
  • You are considering using Wi-Fi triangulation to track the location of wireless devices within your organization. However, you h
    9·1 answer
  • During the data transmission there are chances that the data bits in the frame might get corrupted. This will require the sender
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!