Hey folks, Wish you a very happy Diwali.My last program was about calculating temperature in C. Today, I am going to calculate circumference, area and perimeter in C Programming Language. This is the fifth program of [I] section of Chapter 1:Getting Started of the book, “Let us C” by “Yashwant Kanetkar”. This is getting interesting on my side. I really love writing such posts. So do express your gratitude in the comments below and if you have any doubts, suggestions, etc, then comments section is the best place to visit. So let’s begin, folks!

## Question:

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

## Solution to calculate circumference, area and perimeter in C

First accept the length and breadth of the rectangle, then use the formula for calculating area as length*breadth and perimeter as 2*(length + breadth). Store the values in two different variables. Then accept radius and declare pi as 3.14. Use the formula radius*radius*pi for calculating area of the circle and 2*pi*radius for circumference of the circle. Then we output the circumference, area and perimeter in C console.

#### Download the solution:

Download Program## Program to calculate circumference, area and perimeter in C

#include<stdio.h> #include<conio.h> void main() { float len, br, rectarea, perimeter; int rad; float pi=3.14, cirarea, cir; clrscr(); printf("\nEnter the length of the rectangle: "); scanf("%f",&len); printf("\nEnter the breadth of the rectangle: "); scanf("%f",&br); rectarea = len * br; perimeter = 2 * (len + br); printf("\nArea of the rectangle with length %d and breadth %d is: %f",(int)len,(int)br,rectarea); printf("\nPerimeter of the same rectangle is: %f",perimeter); printf("\n\n\nNow enter radius of the circle: "); scanf("%d",&rad); cirarea = pi * rad * rad; printf("\nArea of the circle : %f",cirarea); cir = 2 * pi * rad; printf("\nCircumference : %f", cir); getch(); }

## Output:

Enter the length of the rectangle: 4

Enter the breadth of the rectangle: 3

Area of the rectangle with length 4 and breadth 3 is: 12.000000

Perimeter of the same rectangle is: 14.000000

Now enter the radius of the circle: 10

Area of the circle : 314.000000

Circumference : 62.800003

#### Download the solution:

Download ProgramHope you enjoyed this tutorial! Please like, share and subscribe to support ReadMeNow. In case of any programming requests, do not hesitate to contact us.