Q:

Write a C program to compute the perimeter and area of a rectangle with a height of 7 inches, and width of 5 inches

0

Write a C program to compute the perimeter and area of a rectangle with a height of 7 inches. and width of 5 inches.

Expected Output:
Perimeter of the rectangle = 24 inches
Area of the rectangle = 35 square inches

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h> 
/* height and width of a rectangle in inches */
int width;          
int height;         
int area;           
int perimeter;      
int main() {
	height = 7;
	width = 5;
    perimeter = 2*(height + width);
	printf("Perimeter of the rectangle = %d inches\n", perimeter);
	area = height * width;
	printf("Area of the rectangle = %d square inches\n", area);
return(0);
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Basic Declarations and Expressions exercises

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C program to compute the perimeter and are... >>
<< Write a C program to print the following character...