Skip to main content

Area and Perimeter of a Rectangle

#include <stdio.h>
int main()
{
  float length, breadth, area, perimeter ;
  printf("Length\t:\t");
  scanf("%f", &length );
  printf("Breadth\t:\t");
  scanf("%f", &breadth );
  area=length*breadth;
  perimeter=2*( length + breadth );
  printf("\nArea\t:\t%f", area);
  printf("\nPerimeter\t:\t%f", perimeter);

  return 0;
}

Length :  5.64
Breadth :  4.86

Area  : 27.41
Perimeter : 21.00 

Comments