Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Math Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
safwat




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
neufelni




PostPosted: 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
HeavenAgain




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: