Sillycodes : C program to Find area and perimeter of a Rectangle

Spread the love
Description : This program for Calculating area and perimeter of a Rectangle. i think you already know the formula’s to calculate the Area and Perimeter of Rectangle. anyway here is the formula

Rectangle Formula :

Area of Rectangle = b × h. 
Perimeter of Rectangle = 2(b) + 2(h). 
where b = breadth, h = height

Program : C program to calculate area and Perimeter of Rectangle :

  1. #include<stdio.h>
  2. int main()
  3. {
  4.         float length,breadth,area,perimeter;  
  5.         printf(“Enter the length of the rectangle:”);
  6.         scanf(“%f”,&length);
  7.  
  8.         printf(“Enter the breadth of the rectangle:”);
  9.         scanf(“%f”,&breadth);
  10.         area = length * breadth;  
  11.         perimeter = 2*(length + breadth);    
  12.  
  13.         printf(“Area of the rectangle with length %d and breadth %d is : %f n,(int)length,(int)breadth,area);
  14.  
  15.         printf(“Perimeter of the rectangle with length %d and breadth %d is : %f n,(int)length,(int)breadth,perimeter);
  16.  
  17.         return 0;
  18. }

Output :

Related Programs :

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply