Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started