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

 Write a C program to compute the perimeter and area of a rectangle with a height of 7 inches. and width of 5 inches.
Expected Output:
Perimeter of the rectangle = 24 inches
Area of the rectangle = 35 square inches
*/
#include<stdio.h>
#define height 7
#define width 5
main(void)
{
float Perimeter_of_the_rectangle=2*(height+width);
float Area_of_the_rectangle=height*width;
printf("Perimeter of the rectangle = %.2f inches\n",Perimeter_of_the_rectangle);
printf("Area of the rectangle = %.2f square inches",Area_of_the_rectangle);
}

    

                                    OR

#include<stdio.h>
main(void)
{
int height=7;
int width=5;
float Perimeter_of_the_rectangle=2*(height+width);
float Area_of_the_rectangle=height*width;
printf("Perimeter of the rectangle = %.2f inches\n",Perimeter_of_the_rectangle);
printf("Area of the rectangle = %.2f square inches",Area_of_the_rectangle);
}

Comments