Write a C program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle

calculation of perimeter and area of rectangle in c
calculation of perimeter and area of rectangle in c

Problem Statement:

The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.

Answer:

/* Calculation of perimeter and area of rectangle and circle */

#include<stdio.h>
#include<conio.h>

main()
{

int l, b, r, area1, perimeter;
float area2, circum;

clrscr();
printf(“\n Enter Length and Breadth of Rectangle”);
scanf(“%d %d”,&l, &b);

area1=l*b; /*Area of rectangle */
perimeter=2*l+2*b; /* Perimeter of rectangle */

printf(“\n Area of Rectangle = %d”, area1);

printf(“\n Perimeter of Rectangle=%d”,perimeter);

Print(“\n\n Enter Radius of circle”);
scanf(“%d”,&r);

area2=3.14*r*r; /* Area of Circle */
circum=2*3.14*4; /* Circumference of a circle */\

printf(“Area of Circle=%f”,area2);
printf(“Circumference of Circle-%f”,circum);

printf(“\n\n\n\n Press any key to exit….”);
getch();

}

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply