C Program to Find Area of Circle

Learn via video course
FREE
View all courses
C++ Course: Learn the Essentials
C++ Course: Learn the Essentials
by Prateek Narang
1000
5
Start Learning
C++ Course: Learn the Essentials
C++ Course: Learn the Essentials
by Prateek Narang
1000
5
Start Learning
Topics Covered

In school, we often enjoyed calculating the areas of various shapes such as rectangles, triangles, and circles. However, these calculations can become complex when dealing with large numbers or decimals. To simplify, let’s develop a program in C to calculate the area of a circle. In this article, we'll explore how to use the area formula effectively within a C program, focusing specifically on circles.

Algorithm for C Program to Find Area of Circle

Here is an algorithm for a C program to find the area of a circle:

  1. Declare variables for the radius and the area of the circle.
  2. Prompt the user to enter the radius of the circle.
  3. Read the user input and store it in the radius variable.
  4. Calculate the area of the circle using the formula area = pi * radius * radius.
  5. Print the area of the circle to the console.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

C Program to Calculate Area of a Circle Using Radius

In this method, we will be calculating the area of a circle using its radius.

As we know, the formula to find the area of a circle, if the radius is given is - Area=π(radius)2Area = π * (radius)^2

area-of-circle-using-radius

Now simply, we have to write a program to convert this logic into code, so let's begin,

Writing Area of circle program in C

Input

Output

Explanation

In the above program, first, we initialize the variable pi with the value of π and take input for radius then using the formula pi*radis*radis calculated the area of the circle.

Complexity Analysis

  • Time Complexity: O(1). This is because the program only performs simple arithmetic operations, which are all constant time operations.
  • Space Complexity: O(1). This is because the program only uses a few variables, which do not grow in size with the input size.

C Program to Calculate the Area of a Circle Using Circumference

In this method, we will be given the circumference of a circle, and using that we have to find its area.

We will again apply the same thing, we know the formula, and all we have to do is write a program using that logic. If we have the circumference of a circle, then we can find its area using the formula

Area=(circumference)24πArea = {(circumference)^2 \over 4 π}

area-of-circle-using-circumference

Writing Area of circle program in C

Input

Output

Explanation

In the above program, first, we initialize the variable pi with the value of π and take input for circumference then using the formula (circumferencecircumference)/(4pi)(circumference * circumference)/(4 * pi) calculated the area of the circle.

Complexity Analysis

  • Time Complexity: O(1). This is because the program only performs simple arithmetic operations, which are all constant time operations.
  • Space Complexity: O(1). This is because the program only uses a few variables, which do not grow in size with the input size.

Conclusion

  • The area of a shape is the measurement of how much space it is covering if kept on a plane.
  • Area of a circle if the radius is given Area=π(radius)2Area = π * (radius)^2
  • Area of a circle if the circumference is given Area=(circumference)24πArea = {(circumference)^2 \over 4 π}
  • Now, we are aware of all the above formulas, so all we have to do is to think about the logic that how to implement these mathematical formulae into a program, and then find the area we need.

See Also

Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more