Java
import java.util.Scanner;
Try it Yourself ➠
Java program using Assignment Operator
11 May
0
Write a program (WAP) in JAVA to read two numbers from keyboard(User Input) and perform addition, subtraction, multiplication and division using assignment operator.
import java.util.Scanner;
public class sarthakmunds3
{
public static void main(String args[])
{
int x, y, result;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Two Numbers :\n ");
x = scan.nextInt();
y = scan.nextInt();
result = x + y;
System.out.println("Addition is : " +result);
result = x - y;
System.out.println("Subtraction is : " +result);
result = x * y;
System.out.println("Multiplication is : " +result);
result = x / y;
System.out.println("Division is : " +result);
}
}
Try it Yourself ➠
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment