Program to find Area and Circumference of Circle

Algorithm

Step 1: Start

Step 2: Declare integer variables r, a, c

Step 3: Take input for radius (r)

Step 4: Compute area as a = PI * r * r

Step 5: Compute circumference as c = 2 * PI * r

Step 6: Print the values of area and circumference

Step 7: End

Flowchart

graph TD; A([Start]) --> B[Declare int r, a, c]; B --> C[/Input r/]; C --> D[Compute a = PI * r * r]; D --> E[Compute c = 2 * PI * r]; E --> F[/Print a, c/]; F --> G([End]); classDef start fill:#00cc44,stroke:#006622,stroke-width:2px,color:#ffffff; classDef stop fill:#ff4444,stroke:#cc0000,stroke-width:2px,color:#ffffff; classDef input_output fill:#ffdd44,stroke:#cc9900,stroke-width:2px,color:#000000; classDef process fill:#4488ff,stroke:#0044cc,stroke-width:2px,color:#ffffff; class A start; class G stop; class B,C,F input_output; class D,E process;

Program

#include<stdio.h>
#include<math.h>
#define PI 3.14
int main()
{
    int r;
    float a, c;
    printf("Enter Radius : ");
    scanf("%d", &r);
    
    // Area
    a = PI * r * r;
    printf("\nArea of Circle : %.2f", a);
    
    // Circumference
    c = 2 * PI * r;
    printf("\nCircumference of Circle : %.2f", c);
    
    return 0;
}
                

Test Case Output
Enter Radius: 5
Area of Circle: 78.50
Circumference of Circle: 31.40