Home
Q&A
Education
Technology
Credit
General
Health
Insurance
Questions
Ask a Question
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.
Home
Education
Write a JAVA program to find the area and...
asked
Dec 21, 2021
in
Education
by
JackTerrance
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
computer-science-interview-questions
computer-science-questions
1
Answer
0
votes
answered
Dec 21, 2021
by
JackTerrance
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
Q: 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
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: write a program code to print area and perimeter of a rectangle
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write the phython code for the following . Write a program to print area perimeter of rectangle.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a program in Java to find the area and perimeter of a right-angled triangle by using function argument. Take perpendicular andbase as inputs.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a program in Java to find the area and perimeter of a right-angled triangle by using function argument. Take perpendicular andbase as inputs.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a program in Java to find the area and perimeter of a right-angled triangle by using function argument. Take perpendicular andbase as inputs.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: 1. Take length and breadth of therectangle from user and calculate thearea of rectangle and print the area ina message box.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write an algorithm and flowchart to find perimeter of rectangle and psuedocode of it’s
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: the angles of a square are in ratio 4:4:4:4 . write a program to find and display all of its angels
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. Display the name of the student, total and average. DO NOT USE ANY INPUT METHOD
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. Display the name of the student, total and average.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a program to accept a filename from the user and display all the lines from the file which contain python comment character ‘#’.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a program to find the perimeter of a triangle with sides measuring 10cm, 14 cm and 15 cm.
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: Write a program to generate first 20 terms of Fibonacci series and store them in single dimension array. Display the prime Fibonacci numbers from the array
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
computer-science-interview-questions
computer-science-questions
0
votes
Q: write a program to store 1st 25 prime number in an erray and display it
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
computer-science-interview-questions
computer-science-questions
...