C Exercises: Calculate the perimeter of a rectangle
3. Rectangle Perimeter Calculation
Write a C program that prints the perimeter of a rectangle using its height and width as inputs.
Pictorial Presentation:

Sample Solution:
C Code:
Sample Output:
Input the height of the Rectangle : 5 Input the width of the Rectangle : 7 Perimeter of the Rectangle is : 24.000000
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to calculate the perimeter of a rectangle and then compute the difference between its perimeter and area.
- Write a C program to compute the perimeter of a rectangle with height and width provided as command-line arguments.
- Write a C program to calculate the perimeter of a rectangle and ensure that both height and width inputs are positive numbers.
- Write a C program to read dimensions for multiple rectangles from a file and output the largest perimeter.
C Programming Code Editor:
Previous: Write a C program that calculates the volume of a sphere.
Next: Write a C program that converts kilometers per hour to miles per hour.
What is the difficulty level of this exercise?
Based on 476 votes, average difficulty level of this exercise is Hard
.
Test your Programming skills with w3resource's quiz.