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. Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Explanation: import java. util. *; class Sqrec { public static void main (String args[]) { Scanner in =new Scanner(System.in) ; System. out. println( “Enter side of square”); int s=in.nextInt() ; System. out println( ” Enter length of rectangle”) ; int ln = in. nextInt() ; System. out. println(” Enter breadth of rectangle “) ; int b=in.nextInt() ; int a1=0; int a2=0; int p1=0; int p2=0; a1= s*s; a2=ln*b; p1= 4*s; p2= 2*(ln +b) ; System. out. println( “Area of square : “+a1) ; System. out. println(” Perimeter of square : “+ p1) ; System. out. println(“Area of rectangle :” + a2) ; System. out. println (“Perimeter of rectangle :” + p2) ; } }

Related questions

0 votes
    Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length as ... USE 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 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
    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 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 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
0 votes
    Write a program to find the perimeter of a triangle with sides measuring 10cm, 14 cm and 15 cm. Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    Write a program to generate first 20 terms of Fibonacci series and store them in single dimension array. Display ... from the array Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    write a program to store 1st 25 prime number in an erray and display it Select the correct answer from above options...
asked Dec 6, 2021 in Education by JackTerrance
...