We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3b31e11 + 169c13d commit cbdf59eCopy full SHA for cbdf59e
Areaofrec.java
@@ -0,0 +1,28 @@
1
+package practice.constructor.program;
2
+import java.util.Scanner;
3
+public class Areaofrec{
4
+ int length,breadth;
5
+ public Areaofrec(int l, int b)
6
+ {
7
+ length = l;
8
+ breadth = b;
9
+ }
10
+ public int returnarea()
11
12
+ return length*breadth;
13
14
+}
15
+class Ans
16
+{
17
+ public static void main(String args[] )
18
19
+ Scanner s = new Scanner(System.in);
20
+ int l,b;
21
+ System.out.println("Enter length:");
22
+ l = s.nextInt();
23
+ System.out.println("Enter breadth:");
24
+ b = s.nextInt();
25
+ Areaofrec a = new Areaofrec(l,b);
26
+ System.out.println("Area of Rectangle: "+a.returnarea());
27
28
0 commit comments