How to add,subtract,multply and division of two number in java
import java.util.*;
public class TestTwo
{
public static void main(String args[])
{
int a,b;
Scanner sc=new Scanner(System.in);
System.out.println("Enter any two number");
a=sc.nextInt();
b=sc.nextInt();
System.out.println("The Sum of Two Number "+(a+b));
System.out.println("The Subtraction of Two Number "+(a-b));
System.out.println("The Multiplication of Two Number "+(a*b));
System.out.println("The Division of Two Number "+(a/b));
}
}
output:
Enter any two number..
20
10
The Sum of Two Number 30
The Subtraction of Two Number 10
The Multiplication of Two Number 200
The Division of Two Number 2
import java.util.*;
public class TestTwo
{
public static void main(String args[])
{
int a,b;
Scanner sc=new Scanner(System.in);
System.out.println("Enter any two number");
a=sc.nextInt();
b=sc.nextInt();
System.out.println("The Sum of Two Number "+(a+b));
System.out.println("The Subtraction of Two Number "+(a-b));
System.out.println("The Multiplication of Two Number "+(a*b));
System.out.println("The Division of Two Number "+(a/b));
}
}
output:
Enter any two number..
20
10
The Sum of Two Number 30
The Subtraction of Two Number 10
The Multiplication of Two Number 200
The Division of Two Number 2
No comments:
Post a Comment