Write a program that will accept the length of one side of a square and calculate the perimeter and area. The program should output the perimeter and area of the square.
Added by Gloria W.
Step 1
You need to write a program that accepts the length of one side of a square and calculates both the perimeter and the area of the square. The program should then output these values. Show more…
Show all steps
Your feedback will help us improve your experience
Liam Haas-Neill and 61 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a program that prompts the user to enter the width and height of a rectangle and displays the perimeter, area, and the length of diagonal. Here is a sample run: Enter the width and height of a rectangle: 4.25 7.26 The perimeter is 23.02 The area is 30.855 The length of the diagonal is 8.412496656760108
Supreeta N.
(Compute the perimeter of a triangle) Write a program that reads three edges for a triangle and computes the perimeter if the input is valid. Otherwise, display that the input is invalid. The input is valid if the sum of every pair of two edges is greater than the remaining edge. Here is a sample run:
Solve each problem. Perimeter. Write a formula for the perimeter of a square as a function of its area.
Additional Function Topics
Combining Functions
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD