Write a C Program to find the Perimeter of a Rectangle using length and width with an example. If we know the length and width, we can calculate the perimeter of a rectangle using the formula: Perimeter = 2 * (Length + Width).
This program allows the user to enter the length and width of a rectangle. Using those values, this Programming code will calculate the Perimeter of a rectangle.
#include<stdio.h> int main() { float width, length, Perimeter; printf ("\n Please Enter the Width of a Rectangle : "); scanf ("%f",&width); printf ("\n Please Enter the Length of a Rectangle : "); scanf ("%f",&length); Perimeter = 2 * (length + width); printf("\n Perimeter of a Rectangle = %.2f", Perimeter); return 0; }