Write a program to calculate the area and circumference of a circle in C language.

Tested on: Turbo C++ Version 4.0Time Complexity: O (1)Space Complexity: O (1)Open Source: MIT
1
2
3
    #include<stdio.h>
4
    #define PI 3.14285714
5
6
    int main()
7
    {
8
        float radius,area,circum;
9
        printf("Enter the Radius of the Circle:");
10
        scanf("%f",&radius);
11
        area=PI*radius*radius;
12
        circum=2*PI*radius;
13
        printf("Area of the Circle is %f",area);
14
        printf("\nCircumference of the Circle is %f:",circum);
15
        return(0);
16
    }
17
        

Output

1
2
3
    Enter the Radius of the Circle:5
4
    Area of the Circle is 78.571426
5
    Circumference of the Circle is 31.428572:
6
        

Rate the Code

Reviews are published after a quick safety check (usually within 24 hours).

Reviews are public. Developers can see basic device specifications to respond. Learn more

How to run the Circle Area & Circumference program in C-Language?

To run the Circle Area & Circumference program in C-Language, follow the below mentioned steps:

  1. Copy the Code: Press the copy button in the code block to copy the complete code.
  2. Open Turbo C++ Version 4: Open the Turbo C++ (Version 4) software on your system.
  3. Paste the code: Paste the copied code into Turbo C++’s editor.
  4. Compile the Code: Compile the program by pressing the Alt+F9 keys. This shows you the errors and warnings, if any.
  5. Run the code: Press the Ctrl+F9 keys to run the program if the program is successfully compiled.
  6. Enter the Input: Provide the required inputs or your desired inputs, if applicable.
  7. Receive the Result: Get the result of the program on the screen based on the provided inputs.

More Area & Circumference program in C language

Aim: To calculate the area & circumference of a circle by getting input from the user.

Program Logic

In this program, two math formulas are used

Area of Circle: π * r 2

Circumference: 2 * π * r

Where π is the PI with the value 3.14285714, and r is the radius of the circle.

Real Life Examples

  1. Calculate the Total Distance covered by a vehicle: To calculate the distance covered by the vehicle by calculating the wheel rotations, this program is used in a vehicle speedometer system.
  2. CNC Machine: To cut circular parts, CNC machines use this area and circumference program.
  3. Image Processing System: To find out the perimeter or area of a circular object from an image, the computer uses this program.
  4. Robotics System: To move the robot parts in circular motion, like the hand, neck, etc., this program is used.
License: This program's source code is open-sourced under the MIT License, while the rest of the program's text content and overall dhimanp platform and brand content remain proprietary under dhimanp.

Submit your modified code

Your submissions are published after a quick safety check (usually within 7 days).

Submissions are public. Developers can see basic device specifications to respond. Learn more

Disclaimer

The information that you shared with us will be publicly visible, and everyone can see your information. And we (dhimanp) are not responsible if anyone misuses this information. We can remove any submitted code at any time for better transparency.

Privacy Policy

If you share your data with us by submitting your code for credit, then we may show your full name, school or college name, and city name on our website.

We are not using this data to track you and are not selling this data to anyone.

If you want to remove your name from our website, you can contact us, and we will remove your name from our website. In the removal process, full credit, including your full name, school or college, city, and code, will be removed from our website.