Perimeter of rectangle in C

Source code :

#include <stdio.h>

int main()
{
 float length=2;
 float width=3;
 float perimeter;
 
 perimeter = 2*(length + width);
 printf("Perimeter of Rectangle : %f\n", perimeter);
  

 return 0;
}

Output :

Perimeter of rectangle:10

Algorithm :

  1. Initialize the values for length and width
  2. Use the perimeter formula
  3. Finally print the result

Output :


                

Comments :