write as java programming Take a no from a user and divide that no by 10 and print the quotient and remainder
Answers
Answer:
to Find Quotient and Remainder
BY CHAITANYA SINGH | FILED UNDER: JAVA EXAMPLES
In this article, we will write a Java program to find Quotient and Remainder, when one number is divided by another number.
Example: Program to find Quotient and Remainder
In the following program we have two integer numbers num1 and num2 and we are finding the quotient and remainder when num1 is divided by num2, so we can say that num1 is the dividend here and num2 is the divisor.
public class JavaExample {
public static void main(String[] args) {
int num1 = 15, num2 = 2;
int quotient = num1 / num2;
int remainder = num1 % num2;
System.out.println("Quotient is: " + quotient);
System.out.println("Remainde
Answer:
import java.util.Scanner;
class MyClass
{
public static void main(String args[])
{
int x, y;
int q, r;
Scanner input = new Scanner(System.in);
System.out.println("Enter a number : ");
x = input.nextInt();
y = 10;
q = x/y;
r = x % y;
System.out.println("The quotient: " + q);
System.out.println("The remainder: " + r);
}
}