
-----------------------------------
vexd
Mon Sep 29, 2003 6:35 pm

Binary To Decimal Covertor
-----------------------------------
%************************************************************************************  ||
%* Author: VeXD                                                                       *__||  
%* Date: Sept, 24 2003                                                               ___)
%* Purpose: To make a program that converts a binary number to decimal.             *
%* Input: A binary number (int)                                                     *  
%* Output: The program will output a integer (number in decimal format)             * 
%************************************************************************************ 

var intBinary : int
var intDigit : int
var intPower : int := 0
var intSum : int := 0

put "Please enter a Binary Digit."
get intBinary

loop
    intDigit := intBinary mod 10
    if intDigit = 1 then
        intSum := intSum + (2 ** intPower)
    end if
    intPower := intPower + 1
    intBinary := intBinary div 10
    exit when intBinary = 0
end loop

put intSum

-----------------------------------
vexd
Mon Sep 29, 2003 11:52 pm


-----------------------------------
CONVERTOR.u all knew what i meant neways ;)

-----------------------------------
Dan
Tue Sep 30, 2003 4:50 pm


-----------------------------------
dan's coverting bi to dec code


put strint("101001",2)


wow that was simple eh?  :lol:

-----------------------------------
vexd
Tue Sep 30, 2003 8:12 pm


-----------------------------------
O M G
