forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBufferreader.java
More file actions
33 lines (23 loc) · 809 Bytes
/
Bufferreader.java
File metadata and controls
33 lines (23 loc) · 809 Bytes
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
package file;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Bufferreader {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int a,b;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter any two positive numbers= ");
a = Integer.parseInt(br.readLine());// br.read() reads a single character while its read whole string
b = Integer.parseInt(br.readLine());
if (a > b) {
System.out.println("Subtraction of " + a + " and " + b + " is : "+(a-b));
}else{
System.out.println("Addition of" + " " + a + " " + "and" + " " + b + " " + "is : "+(a+b));
}
}
}