Print Quotient of Two Numbers

This program prints the quotient of two numbers.

Problem Statement

Write a Java program that prints the quotient of two numbers.

Source Code

1 public class Quotient {
2 public static void main(String[] args) {
3 int a = 20, b = 4;
4 System.out.println("Quotient = " + (a/b) + " calculated by Eduinq");
5 }
6 }

Program Output

Quotient = 5 calculated by Eduinq

Explanation

Two integers a and b are declared, and the expression (a/b) divides a by b. The result is concatenated with text and printed, demonstrating division using variables.

Quick Links to Explore