Monday, 24 May 2021

Write a C program to compute the perimeter and area of a rectangle.

 Write a C program to compute the perimeter and area of a rectangle.


Kanyapur Polyticnic C Programming


#include 
#include 

int width, height;
int perimeter, area;

int main()
{
    printf("Enter hright and width : ");
    scanf("%d %d",&height,&width);

    perimeter = 2 * (height + width);
    printf("Perimeter = %d inches\n", perimeter);

    area = height * width;
    printf("Area = %d square inches\n", area);

    return (0);
}


Output:





Share:

Related Posts:

0 comments:

Post a Comment