/* -------------------------------------------------------
   File   : rectangle.c
   Purpose: Calculate area and perimeter of any rectangle
   Author : Lew Baxter
   Date   : 2008-01-17
   ------------------------------------------------------- */

#include <stdio.h>

main()
{
   int length, width, perimeter, area;

   /*  output title  */

   printf("=== RECTANGLE CALCULATOR ===\n");

   /*  ask user for length and width  */

   printf("Enter length: ");
   scanf("%d", &length);
   printf("Enter width: ");
   scanf("%d", &width);

   /*  calculate perimeter and area  */

   perimeter = 2 * ( length + width );
   area = length * width;

   /* output perimeter and area  */

   printf("Perimeter = %d and area = %d\n", perimeter, area);
}