i wrote my codes but my prob is:<br />1. when u read a binary it start from the right, but 4 ME IT START FROM THE LEFT<br /> EXAMPLE: 110 = 6<br /> FOR ME THE ANS IS 3<br /> SO HELP PLZZ<br />2. a code to validate<br /> if some1 enter 1002 as binary disply error<br />hope i got help<br /><br />here's my code plz add the validation code and correct the first prob<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->program BinToDec;<br /><br />uses wincrt;<br /><br />Var<br />Â Â Binary:string;<br />Â Â Len:integer;<br />Â Â base:integer;<br />Â Â counter:integer;<br />Â Â Result:integer;<br /><br />Begin<br />Â Â Â Â writeln('Enter a binary number: ');<br />Â Â Â Â Readln(Binary);<br />Â Â Â Â Len:= Length(binary);<br />Â Â Â Â Base:=1;<br />Â Â Â Â Result:=0;<br />Â Â Â Â For counter:=1 to Len do<br />Â Â Â Â Â Â Â Â begin;<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (Binary[counter]='1') then<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â result:= result+ base;<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â base:=base*2;<br />Â Â Â Â Â Â Â Â end;<br /><br />Â Â Â Â writeln(result);<br />end.<!--c2--></div><!--ec2-->
</div>
</div>