Difference between revisions of "C Language Practice: Binary to Decimal"

Jump to navigation Jump to search
Created page with "== Binary to Decimal == This is my first practice. I got a bit confused with the code when I first met the problem, but in the end I got it. ‎<syntaxhighlight lang="c" line style="border: 1px solid red;"> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int btod(char *binary) { int i; int decimal = 0; int place = 0, temp = 0; for(i = strlen(binary) - 1; i >= 0; --i) { if ((binary[i] == '0') || (binary[i] == '..."
(Created page with "== Binary to Decimal == This is my first practice. I got a bit confused with the code when I first met the problem, but in the end I got it. ‎<syntaxhighlight lang="c" line style="border: 1px solid red;"> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int btod(char *binary) { int i; int decimal = 0; int place = 0, temp = 0; for(i = strlen(binary) - 1; i >= 0; --i) { if ((binary[i] == '0') || (binary[i] == '...")
 
(No difference)
270

edits

Navigation menu