Notification texts go here Contact Us Buy Now!

Mastering Circle Math: Calculating Circumference and Area in C

Calculating Circumference and Area of a Circle in C

Calculating Circumference and Area of a Circle in C

In this blog post, we'll explore a simple C program that calculates the circumference and area of a circle based on the provided radius. Let's take a look at the C code:

#include <stdio.h>

int main() {
    const double PI = 3.14159;
    double radius;
    double circumference;
    double area;

    printf("\nEnter radius of a circle :");
    scanf("%lf", &radius);

    circumference = 2 * PI * radius;
    area = PI * radius * radius;

    printf("Circumference: %lf\n", circumference);
    printf("Area: %lf\n", area);

    return 0;
}
        

Copy and paste this C code into your favorite compiler, and you'll be able to calculate the circumference and area of a circle by providing the radius.

Feel free to modify and experiment with the code to enhance your understanding of C programming. Happy coding!

About the Author

Coding | Riding | Music, Embracing the beauty of code, the thrill of the ride, and the rhythm of life. Let's explore the journey together!

إرسال تعليق

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.
Code Copied!