Computer Science, asked by callforgaming22, 4 months ago

write a program to take input length and breadth of a rectangle and find out its parameter and area print them with message​

Answers

Answered by freedarajesh2003
1

Answer:

Explanation:

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

C programming: Perimeter of a rectangle

A perimeter is a path that surrounds a two-dimensional shape. The word comes from the Greek peri (around) and meter (measure). The perimeter can be used to calculate the length of fence required to surround a yard or garden. For rectangles or kites which have only two different side lengths, say x and y, the perimeter is equal to 2x + 2y

Pictorial Presentation:

C programming: perimeter of a rectangle  

C programming: Area of a rectangle

The area of a two-dimensional figure describes the amount of surface the shape covers. You measure area in square units of a fixed size, square units of measure are square inches, square centimeters, or square miles etc. The formula for the area of a rectangle uses multiplication: length • width = area.  A rectangle with four sides of equal length is a square.

Pictorial Presentation:

C programming: area of a rectangle  

C Code:

#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);

}

Copy

Sample Output:

Perimeter of the rectangle = 24 inches                                  

Area of the rectangle = 35 square inches

Flowchart:

C Programming Flowchart: Compute the perimeter and area of a rectangle

C Programming Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a C program to print the following characters in a reverse way.

Next: Write a C program to compute the perimeter and area of a circle with a radius of 6 inches.

What is the difficulty level of this exercise?

EASY MEDIUM HARD

Based on 565 votes, average difficulty level of this exercise is Easy .

 

 

New Content published on w3resource:

Scala Programming Exercises, Practice, Solution

Python Itertools exercises

Python Numpy exercises

Python GeoPy Package exercises

Python Pandas exercises

Python nltk exercises

Python BeautifulSoup exercises

Form Template

Composer - PHP Package Manager

PHPUnit - PHP Testing

Laravel - PHP Framework

Angular - JavaScript Framework

React - JavaScript Library

Vue - JavaScript Framework

Jest - JavaScript Testing Framework

by TaboolaSponsored LinksYou May Like

A Post Graduate Program in Data Science And Business Analytics, Designed for Working Professionals

Great Learning

With a Happiness Kit You Make A Child Smile

Akshaya Patra

30 Wedding Photos That Went Horribly Wrong

Gloriousa

A Coolie And A Widow. Help This Single Mother Save Her Son

Ketto

Born Between 1965-1985? Get Term Life Insurance Worth ₹1 Cr at Rs.1884/month*.

Term Plans -Compare & Buy Now!

Empower Your Child’s Curiosity and Inquisitiveness: Detective Workshop. Age 6-12

Uable

   

 

 

Similar questions