|
|
@ -12,10 +12,13 @@ public class MathProblems |
|
|
int b=1; |
|
|
int b=1; |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
System.out.print("Enter a: "); |
|
|
|
|
|
|
|
|
System.out.print("Enter the numerator: "); |
|
|
a = input.nextInt(); |
|
|
a = input.nextInt(); |
|
|
System.out.print("Enter b: "); |
|
|
|
|
|
|
|
|
System.out.print("Enter the divisor: "); |
|
|
b = input.nextInt(); |
|
|
b = input.nextInt(); |
|
|
|
|
|
int div = a/b; |
|
|
|
|
|
int mod = a%b; |
|
|
|
|
|
System.out.println(a+" / "+b+" is "+div+" with a remainder of "+mod); |
|
|
} |
|
|
} |
|
|
catch(InputMismatchException ime) |
|
|
catch(InputMismatchException ime) |
|
|
{ |
|
|
{ |
|
|
@ -35,3 +38,4 @@ public class MathProblems |
|
|
functions.divide(); |
|
|
functions.divide(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|