|
|
|
@ -9,13 +9,16 @@ public class MathProblems |
|
|
|
{ |
|
|
|
Scanner input = new Scanner(System.in); |
|
|
|
int a=1; |
|
|
|
int b=1; |
|
|
|
int b=1; |
|
|
|
try |
|
|
|
{ |
|
|
|
System.out.print("Enter a: "); |
|
|
|
System.out.print("Enter the numerator: "); |
|
|
|
a = input.nextInt(); |
|
|
|
System.out.print("Enter b: "); |
|
|
|
System.out.print("Enter the divisor: "); |
|
|
|
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) |
|
|
|
{ |
|
|
|
@ -25,7 +28,7 @@ public class MathProblems |
|
|
|
{ |
|
|
|
System.out.println("You can't divide "+a+" by "+b); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static void main( String[] args ) |
|
|
|
@ -35,3 +38,4 @@ public class MathProblems |
|
|
|
functions.divide(); |
|
|
|
} |
|
|
|
} |
|
|
|
|