-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperators.java
More file actions
28 lines (28 loc) · 1.01 KB
/
Operators.java
File metadata and controls
28 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
class Operators{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int num1,num2;
System.out.println("Enter Number 1:");
num1=sc.nextInt();
System.out.println("Enter Number 2:");
num2=sc.nextInt();
System.out.println("Sum of both numbers is:"+(num1+num2));
System.out.println("Difference of both numbers is:"+(num1-num2));
System.out.println("Product of both numbers is:"+(num1*num2));
System.out.println("Division of both numbers is:"+(num1/num2));
System.out.println("Remainder of both numbers is:"+(num1%num2));
if(num1==num2)
{
System.out.println("Both Numbers are Equal");
}
else if(num1>num2)
{
System.out.println("Number 1:"+num1+" is greater than Number 2:"+num2);
}
else
{
System.out.println("Number 1:"+num1+" is less than Number 2:"+num2);
}
}
}