Skip to content
Home » C Program to Find the Circumference of a Rectangle

C Program to Find the Circumference of a Rectangle

Learn about C Program to Find the Circumference of a Rectangle in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Find the Circumference of a Rectangle

Program:

#include<stdio.h>
int main()
{
  float len, wid, result;

  printf("Enter length and width of rectangle: ");
  scanf("%f %f", &len, &wid);

  result = 2*(len + wid);
  printf("Circumference = %.2f", result);

  return 0;
}

Output:

Enter length and width of rectangle: 4 6
Circumference = 20.00

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find the Circumference of a Triangle
C Program to Find the Circumference of a Circle