Java program to compute quotient and remainder
Sure, here is a Java program to compute the quotient and remainder of two numbers:
import java.util.Scanner;
public class QuotientRemainder {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter dividend: ");
int dividend = input.nextInt();
System.out.print("Enter divisor: ");
int divisor = input.nextInt();
int quotient = dividend / divisor;
int remainder = dividend % divisor;
System.out.println("Quotient = " + quotient);
System.out.println("Remainder = " + remainder);
}
}Source:figi.wwwtidea.comThis program first prompts the user to enter the dividend and divisor using the Scanner class. It then calculates the quotient by dividing the dividend by the divisor using the / operator, and calculates the remainder using the % operator. Finally, it prints out the values of the quotient and remainder to the console.
