Sunday, March 31, 2019

Area of Rectangle (CORE JAVA)

 Area of Rectangle:                                                                                                                              EDITED BY- SAYANI



import java.util.Scanner;
class rect
                {
                                int l,b;
                                void input()
                                                {
                                                                Scanner n=new Scanner(System.in);
                                                                l=n.nextInt();
                                                                b=n.nextInt();
                                                }
                                void output()
                                                {
                                                                System.out.println("area="+l*b);
                                                }
                }
class rect1
                {
                                public static void main(String args[])
                                {
                                                cl ob=new cl();
                                                ob.input();
                                                ob.output();
                                }
                }


Output:
E:\>javac rect1.java

E:\>java rect1
2
5
Area=10

E:\>

No comments:

Post a Comment