Computer Science Canada

Binary To Decimal Covertor

Author:  vexd [ Mon Sep 29, 2003 6:35 pm ]
Post subject:  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

Author:  vexd [ Mon Sep 29, 2003 11:52 pm ]
Post subject: 

CONVERTOR.u all knew what i meant neways Wink

Author:  Dan [ Tue Sep 30, 2003 4:50 pm ]
Post subject: 

dan's coverting bi to dec code

code:

put strint("101001",2)


wow that was simple eh? Laughing

Author:  vexd [ Tue Sep 30, 2003 8:12 pm ]
Post subject: 

O M G


: