Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi i'll like some help on this question. The following C program is to convert numbers from binary to decimal: #include void main () {

Hi i'll like some help on this question.

The following C program is to convert numbers from binary to decimal:

#include

void main () { char bin[80]; int i = 0, dec = 0; printf("Enter binary number: "); scanf("%s", bin); while (bin[i] != 0) { if (bin[i] == '0') dec = dec * 2; else if (bin[i] == '1') dec = dec * 2 + 1; else printf("Bad character %c in the number. ", bin[i]); i = i + 1; } printf("The decimal equivalent is %d ", dec);

}

The following C program is to convert numbers from binary to decimal:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions