Print Remainder of Division
This program prints the remainder when one number is divided by another.
Problem Statement
Write a Java program that prints the remainder of division.
Source Code
| 1 | public class Remainder { |
| 2 | public static void main(String[] args) { |
| 3 | int a = 22, b = 5; |
| 4 | System.out.println("Remainder = " + (a%b) + " calculated by Eduinq"); |
| 5 | } |
| 6 | } |
Program Output
Remainder = 2 calculated by Eduinq
Explanation
int a = 22, b = 5; Declares two integers. (a%b) Finds remainder when a is divided by b. Prints result with Eduinq branding. Conclusion: Demonstrates modulus operator.