C program to find perimeter of a rectangle
C Programming Language Fundamentals of C Language (Article) Fundamentals of C Language (Program)
3578Program:
/** * C program to find perimeter of rectangle */ #include"stdio.h" int main() { float length, width, perimeter; /* * Reads length and width of rectangle from user */ printf("Enter length of the rectangle: "); scanf("%f", &length); printf("Enter width of the rectangle: "); scanf("%f", &width); /* Calculates perimeter of rectangle */ perimeter = 2 * (length + width); /* Prints perimeter of rectangle */ printf("Perimeter of rectangle = %f units \n", perimeter); return 0; }
Output:
Enter length of the rectangle: 6 Enter width of the rectangle: 5 Perimeter of rectangle = 22.000000 units Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.