-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAcArithOperations.java
More file actions
52 lines (36 loc) · 1.31 KB
/
Copy pathAcArithOperations.java
File metadata and controls
52 lines (36 loc) · 1.31 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package bas1;
import java.util.Scanner;
public class AcArithOperations {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.println("Enter two numbers");
// nextInt() reads the next integer from the keyboard
int first = reader.nextInt();
int second = reader.nextInt();
System.out.println(first + " " + second);
// add two numbers
int sum = first + second;
System.out.println("The sum is: " + sum);
// diff between two numbers
int diff = first - second;
System.out.println("The differs is: " + diff);
// multiply two numbers
int mul = first * second;
System.out.println("The product is: " + mul);
// division two numbers
int div = first / second;
System.out.println("The div is: " + div);
// finding the remainder
int rem = first % second;
System.out.println("The remainder is: " + rem);
float firstf = 1.5f;
float secondf = 2.0f;
float productf = firstf * secondf;
System.out.println("The product is: " + productf);
firstf=reader.nextFloat();
secondf=reader.nextFloat();
productf = firstf * secondf;
System.out.println("The product is: " + productf);
reader.close();
}
}