Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
586 B
0
Indexable
Never
public class Calculator {
    public static void main(String[] args){
        int x = Integer.parseInt(args[0]);
        int y = Integer.parseInt(args[1]);
        // Sum
        int sum = x + y;
        // Difference
        int diff = x - y;
        // Product
        int product = x*y;
        // Quotient
        int quot = x/y;
        // Remainder
        int remai = x%y;
        System.out.printf("The Result of operations on %d and %d are:\nSum = %d\nDifference = %d\nProduct = %d\nQuotient = %d\nRemaider = %d", x, y, sum, diff, product, quot, remai);
    }
}
Leave a Comment