Jump to content

C Source Code/Find the area and circumference of a circle

From Wikiversity
#include <stdio.h>

int main(void)
{
    float radius, area, circum;

    printf("Enter radius: ");
    scanf("%f", &radius);
    area   = radius * radius * 22 / 7; /* πr² */
    circum = 2 * radius * 22 / 7;      /* 2πr */
    printf("Area = %f\nCircumference = %f\n", area, circum);

    /* indicate success */
    return 0;
}