Write a program in Java that accepts two parameters , X and Y of int data type , and displays their addition , substraction, multiplication , division , and remainder values .
Best of luck .
No spam answers . Be brainly
Answers
Answered by
15
The given problem is solved using language - Java.
public class Java{
public static void main(int x,int y){
System.out.println("You entered x = "+x+" and y = "+y);
System.out.println("Sum: "+(x+y));
System.out.println("Difference: "+(x-y));
System.out.println("Product: "+x*y);
System.out.println("Quotient: "+x/y);
System.out.println("Remainder: "+x%y);
}
}
Variable x and y are taken as input and the required operations are carried out using arithmetic operators.
You entered x = 5 and y = 2
Sum: 7
Difference: 3
Product: 10
Quotient: 2
Remainder: 1
See attachment for verification.
Attachments:
anindyaadhikari13:
Thanks for the brainliest :)
Similar questions