write a program in blu j using iny varialble to find area and perimetre of a rectangle with length 12cm and breadth 8cm
Answers
Answered by
4
Class Question
{ static void main()
{int
Length =12 , Breadth = 8, area, perimeter;
Area = length × breadth ;
perimeter = 2×(l + b)
system.out.println
("Area =" + area) ;
system.out.println ("Perimeter + perimeter) ;
}}
Answered by
1
import java. util.* ;
class Computer
{
void input ()
{
Scanner sc = new Scanner ( System.in ) ;
System. out. println (" Enter the length and breadth of the rectangle : ") ;
int l = sc.nextInt() ;
int b = sc. nextInt() ;
double a ;
}
void cal ()
{
a = l * b ;
}
void dis ()
{
System.out.println( " The area of the rectangle is : "+a) ;
}
public static void main ()
{
Computer obj = new Computer () ;
obj. input () ;
obj. cal () ;
obj. dis () ;
}
}
Similar questions