Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Adding, Subtracting Fractions in Java

878629Aug 5 2011 — edited Aug 7 2011
I am trying to make an application that inputs 2 fractions and adds,subs,multi, divides them.


I have most of my methods complete, its just I can't figure out how to successfully use the euclidean algorithm for my adding method


this is my gcd class


public static int gcd(int a, int b){

if(b == 0)
return a;

return gcd(b, a % b);


i am trying to call it in my adding method, but it outputs (b, a % b) two numbers

can someone help me out with this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2011
Added on Aug 5 2011
19 comments
1,775 views