- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution.java
More file actions
Latest commit
33 lines (29 loc) · 786 Bytes
/
Copy pathsolution.java
File metadata and controls
33 lines (29 loc) · 786 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
// github.com/Utkarsh299-tech/
importjava.io.*;
importjava.util.*;
importjava.text.*;
importjava.math.*;
importjava.util.regex.*;
publicclassSolution {
privatestaticintB;
privatestaticintH;
privatestaticbooleanflag;
static {
Scannersc = newScanner(System.in);
B = sc.nextInt();
H = sc.nextInt();
sc.close();
if(B <= 0 || H <= 0) {
System.out.println("java.lang.Exception: Breadth and height must be positive");
flag = false;
} else {
flag = true;
}
}
publicstaticvoidmain(String[] args){
if(flag){
intarea=B*H;
System.out.print(area);
}
}//end of main
}//end of class