Computer Science Canada

Math Help

Author:  safwat [ Fri Jun 15, 2007 9:52 am ]
Post subject:  Math Help

Hi i need help in making math equations in turing. Like finding area of shapes, circumference of circle, adding, subtracting, dividing and multiplying

Author:  neufelni [ Fri Jun 15, 2007 10:03 am ]
Post subject:  RE:Math Help

It's really no different than on paper.

Turing:

put "Area of a 2 x 2 square is: ", 2 * 2
put "3 multiplied by 5 is: ", 3 * 5


However, you probably will want to use variables.
Turing:

var A, l, w : int
l := 2
w := 2
A := l * w
put "Area: ", A

Author:  HeavenAgain [ Fri Jun 15, 2007 10:17 am ]
Post subject:  RE:Math Help

wrong section Very Happy this is the tutorials section
and for adding, subtracting, dividing etc, its pretty easy
but first you have to understand int, and real, and maybe variables (they are very handy)

1*3 <<-- thats 1 times 3, gives you 3
1 div 3 <<-- that will give you an int, rounded off, which is 0
1 / 3 <<--- that will give you an real, to 6th decimal places i beleive..
and adding stubtracting..... + and - ? O__O pretty easy stuff

for more complicated equations, you can look up in the turing help, and search for Math

example :
Math.Pi
Math.sqrt
etc

Very Happy good luck on it


: