in Education by
Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length as ‘ln’ and breadth as ‘b’. display the results in separate lines. DO NOT USE ANY INPUT METHOD Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Answer: public class area_perimeter { public static void main(String[]args) { int s = 20; //example for side is 20 int ln= 40; //example for side is 40 int b=30; //example for side is 30 int area_square , area_rectangle , perimeter_square , perimeter_rectangle,area_square = s*s ; area_rectangle = ln*b ; perimeter_square = 4*s; perimeter_rectangle = 2*(l+b); System.out.println(“area of the square=” + area_square); System.out.println(“area of the rectangle=”+area_rectangle); System.out.println(“perimeter of the square=”+perimeter_square); System.out.println(“perimeter of the rectangle=”+perimeter_rectangle); } } Explanation:

Related questions

0 votes
    Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length ... results in separate lines. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. ... ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    write a program code to print area and perimeter of a rectangle Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
0 votes
    Write the phython code for the following . Write a program to print area perimeter of rectangle. Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    Write a program in Java to find the area and perimeter of a right- angled triangle by using function ... inputs. angled triangle Select the correct answer from above options...
asked Dec 7, 2021 in Education by JackTerrance
0 votes
    Write a program in Java to find the area and perimeter of a right- angled triangle by using function ... inputs. angled triangle Select the correct answer from above options...
asked Dec 5, 2021 in Education by JackTerrance
0 votes
    Write a program in Java to find the area and perimeter of a right- angled triangle by using function ... inputs. angled triangle Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    1. Take length and breadth of the rectangle from user and calculate the area of rectangle and print the area in ... box. Your answer Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. ... total and average. Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    Write an algorithm and flowchart to find perimeter of rectangle and psuedocode of it’s Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    the angles of a square are in ratio 4:4:4:4 . write a program to find and display all of its angels Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    java program to input any string then print each word along with their length Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    write a Java program to input 10 non-zero numbers in an array and display the count of even and odd numbers. URGENT! Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    Write a program to accept a filename from the user and display all the lines from the file which contain python comment character ‘#’. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
...