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

Username:   Password: 
 RegisterRegister   
 Lowest Common Denominator in Turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Grim




PostPosted: Thu Nov 18, 2010 3:46 pm   Post subject: Lowest Common Denominator in Turing

What is it you are trying to achieve?
How would I find a lowest common denominator in Turing? I need to add fractions and can't find the lowest common denominator


Describe what you have tried to solve this problem
I tried a for loop, so if the first denominator not = the other, multiply the first one by i until they were equal, elsif the first one is greater than the second, multiply the second by i, but this didn't work. Instead of getting 1x1 *check* 1x2 *check* I got 1x2x3x4x5... Which obviously didn't work. Any way of finding an LCD easily?
Sponsor
Sponsor
Sponsor
sponsor
DtY




PostPosted: Thu Nov 18, 2010 4:15 pm   Post subject: RE:Lowest Common Denominator in Turing

Despite what math teachers have told you, you don't need the lowest common denominator. You just need a common denominator. The easiest way to get that is to multiply the denominators together.

However, if you do not take the lowest common denominator, you will need to reduce the resulting fraction, ie. find the greatest common divisor. Which is much easier to do. See Euclid's Algorithm.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: