# Thread: Need help on Fraction

1. Member
Join Date
Jul 2009
Posts
1
Rep Power
0

## Need help on Fraction

hi, I'm new to java and I need some idea on how can I do this program.

For example:
numerator: 7
denominator: 49
fraction type: proper fraction //the class will identify whether the fraction is proper, improper or mixed fractions
decimal equiv: 0.14286

Can anyone help me?

Thanks!

2. Look at the / and % operators, especially when applied to int with an int result.

3. Member
Join Date
Jul 2009
Posts
4
Rep Power
0

## Well ..jus see this

i wud say the solution is as simple as that ... but ..i m not sure abt the input .. how wud u input the numbers ?? jus numerator and denominator? then this shud work fine

import java.util.*;
public class fractions {

/**
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int num,deno;
Scanner scanboy = new Scanner(System.in);
System.out.println("Enter num");
num = scanboy.nextInt();
System.out.println("Enter deno");
deno = scanboy.nextInt();
System.out.println("the fraction is " + num +"/" +deno++);
if ( num > deno)
System.out.println("Its an Improper fraction");
else
System.out.println("Its a Proper Fraction");
}

}

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•