In this tutorial we are going to write a program to calculate area and perimeter of a rectangle.Here we are going to use input and output statement for programming.

1.The main input of this program is length and breadth of the rectangle.we are going to take input from the user through scanf() statement.

2.As a processing step we need to calculate the area and perimeter of the rectangle.

3.After calculating the area and perimeter we are going to display the area and perimeter.

Hence from the above points we are going to write the program.

#include<stdio.h>
#include<conio.h>
void main()
{
float length,breadth,area,perimeter; //variables to store the values from the users
clrscr(); //To clear the output screen
printf("\nEnter the length of the rectangle:");
scanf("%f",&length);
printf("\nEnter the breadth of the rectangle:");
scanf("%f",&breadth);
area = length * breadth; //Calculating the area using the formula.
perimeter = 2*(length + breadth); //Calculating the perimeter using the formula.
printf("\nArea of the rectangle with length %d and breadth %d is:%f",(int)length,(int)breadth,area);
printf("\n\nPerimeter of the rectangle with length %d and breadth %d is:%f",(int)length,(int)breadth,perimeter);
getch();
}

OUTPUT:

You can download the program:download

If you have doubts please mention them in comments

### Like this:

Like Loading...

*Related*

## About Anuroop D

Very enthusiastic about technology and likes to share my knowledge through blogging. Has Bachelor's in Information Technology and currently pursuing my Master's in Computer Science.

thanx your program

Keep Me Updated With More Feeds

Thanks help full……………!