Calculator Tutorial
From ComputerCraft Wiki
Revision as of 20:17, 28 April 2012 by 80.199.134.106 (Talk) (Created page with "add = "add" subtract = "subtract" multiply = "multiply" devide = "devide" print ("Do you want to add, subtract, multiply or devide?") write ("") put = io.read() write ("Enter ...")
add = "add" subtract = "subtract" multiply = "multiply" devide = "devide" print ("Do you want to add, subtract, multiply or devide?") write ("") put = io.read() write ("Enter your first number: ") input = io.read() write ("Enter your second number: ") output = io.read() if put == add then x = input + output print ("That = ", x) elseif put == subtract then x = input - output print ("That = ", x) elseif put == multiply then x = input * output print ("That = ", x) elseif put == devide then x = input / output print ("That = ", x) end sleep(2) term.clear() term.setCursorPos(1, 1)