Write a program that prints the sum, difference, product, quotient and remainder of two numbers. Initialize the numbers with the values 44 and 2.
public class Main
{
public static void main(String[] args) {
int a=44;
int b=2;
System.out.println(a + " + " + b + " = " + (a + b));
System.out.println(a + " - " + b + " = " + (a - b));
System.out.println(a + " x " + b + " = " + (a * b));
System.out.println(a + " / " + b + " = " + (a / b));
System.out.println(a + " mod " + b + " = " + (a % b));
}
}
Comments
Leave a comment