In: Computer Science
1) Ask the user for a dividend and a divisor both of "int" type.
2) Computes the remainder of the division. The quotient (answer) must be of the "int" type.
Do NOT use the method " % " provided in Java in your code. Remember that it gives wrong answers when some of the inputs are negative.
import java.util.Scanner;
public class ModuleOp {
public static void main(String[] args) {
Scanner sc = new
Scanner(System.in);
// reading dividend from user
System.out.println("Enter dividend
");
int dividend = sc.nextInt();
// reading divisor from user
System.out.println("Enter divisor
");
int divisor = sc.nextInt();
// printing the reminder using %
operator
System.out.println("Reminder : " +
(dividend / divisor));
sc.close();
}
}