Formulas:
Area of rectangle: height*width
Perimeter of rectangle: 2*(height+width)
C Code
#include<stdio.h>
#include<conio.h>
void main()
{
float width,height,area,perimeter;
printf("Enter Width of Rectangle: ");
scanf("%f", &width);
printf("Enter Height of Rectangle: ");
scanf("%f",&height);
area=height*width;
printf("\nArea of Rectangle: %.2f", area);
perimeter=2*(height+width);
printf("\nPerimeter of Rectangle are: %.2f", perimeter);
getche()
}
C++ Code
#include<iostream>
using namespace std;
int main()
{
float width,height,area,perimeter;
cout << "Enter Width of Rectangle: ";
cin >> width;
cout << "Enter Height of Rectangle: ";
cin >> height;
area=height*width;
cout << "Area of Rectangle: " << area << endl;
perimeter=2*(height+width);
cout << "Perimeter of Rectangle are: " << perimeter << endl;
return 0;
}Output:
Other Related Search Terms
- C++ program to find area of rectangle
- C program to find perimeter of rectangle
- C++ and c program for area of rectangle

![[C/C++] Program to Find The Perimeter And Area of a Rectangle](https://fsconline.info/wp-content/uploads/2015/09/c-cpp-programming.jpg)
