-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.java
More file actions
20 lines (20 loc) · 786 Bytes
/
Copy pathCalculator.java
File metadata and controls
20 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*creating calculator using java and also taking input from the user*/
import java.util.Scanner;
class Calculator{
public static void main(String args[]){
int a;
int b;
Scanner num1=new Scanner(System.in);
System.out.println("Enter first number :");
a=num1.nextInt();
Scanner num2=new Scanner(System.in);
System.out.println("Enter second number :");
b=num2.nextInt();
System.out.println("the following is the output of calculator");
System.out.println("the addition of the given number is:" + (a+b));
System.out.println("the subtraction of the given number is:" + (a-b));
System.out.println("the division of the given number is:" + (a/b ));
System.out.println("the multipication of the given number is:"+ (a*b));
System.out.println("the reminder of the given number is:" + (a%b));
}
}