<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mreric.org/index.php?action=history&amp;feed=atom&amp;title=C_Language_Practice%3A_Binary_to_Decimal</id>
	<title>C Language Practice: Binary to Decimal - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mreric.org/index.php?action=history&amp;feed=atom&amp;title=C_Language_Practice%3A_Binary_to_Decimal"/>
	<link rel="alternate" type="text/html" href="https://wiki.mreric.org/index.php?title=C_Language_Practice:_Binary_to_Decimal&amp;action=history"/>
	<updated>2026-11-11T03:58:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.mreric.org/index.php?title=C_Language_Practice:_Binary_to_Decimal&amp;diff=33&amp;oldid=prev</id>
		<title>Eric: Created page with &quot;== 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.  ‎&lt;syntaxhighlight lang=&quot;c&quot; line style=&quot;border: 1px solid red;&quot;&gt;  #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt;  int btod(char *binary) {     int i;     int decimal = 0;     int place = 0, temp = 0;      for(i = strlen(binary) - 1; i &gt;= 0; --i)     {         if ((binary[i] == &#039;0&#039;) || (binary[i] == &#039;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.mreric.org/index.php?title=C_Language_Practice:_Binary_to_Decimal&amp;diff=33&amp;oldid=prev"/>
		<updated>2022-03-06T07:19:59Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== 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.  ‎&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line style=&amp;quot;border: 1px solid red;&amp;quot;&amp;gt;  #include &amp;lt;stdio.h&amp;gt; #include &amp;lt;string.h&amp;gt; #include &amp;lt;stdlib.h&amp;gt; #include &amp;lt;math.h&amp;gt;  int btod(char *binary) {     int i;     int decimal = 0;     int place = 0, temp = 0;      for(i = strlen(binary) - 1; i &amp;gt;= 0; --i)     {         if ((binary[i] == &amp;#039;0&amp;#039;) || (binary[i] == &amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Binary to Decimal ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line style=&amp;quot;border: 1px solid red;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int btod(char *binary)&lt;br /&gt;
{&lt;br /&gt;
    int i;&lt;br /&gt;
    int decimal = 0;&lt;br /&gt;
    int place = 0, temp = 0;&lt;br /&gt;
&lt;br /&gt;
    for(i = strlen(binary) - 1; i &amp;gt;= 0; --i)&lt;br /&gt;
    {&lt;br /&gt;
        if ((binary[i] == &amp;#039;0&amp;#039;) || (binary[i] == &amp;#039;1&amp;#039;))&lt;br /&gt;
        {&lt;br /&gt;
            temp = binary[i] - &amp;#039;0&amp;#039;;&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            printf(&amp;quot;error: not a valid binary number\n&amp;quot;);&lt;br /&gt;
            exit(0);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        decimal += temp * pow(2, place);&lt;br /&gt;
        place++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;the decimal number of this binary number is: %d\n&amp;quot;, decimal);&lt;br /&gt;
&lt;br /&gt;
    return decimal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
    char binary[10];&lt;br /&gt;
    scanf(&amp;quot;%s&amp;quot;, binary);&lt;br /&gt;
&lt;br /&gt;
    btod(binary);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eric</name></author>
	</entry>
</feed>