Calculate the Area and Circumference of the circle

C program to calculate the area and circumference of the circle.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
    float radius;

	printf("Enter the radius of circle\t:");
	scanf("%f",&radius);

	printf("\nArea of circle         = %f",3.14 * radius * radius);
	printf("\ncircumference of circle    = %f",2 * 3.14 * radius);

	getch();
}

Output

Enter the radius of circle      :6

Area of circle         = 113.040000
circumference of circle    = 37.680000

Explanation

In the above program, radius of circle is entered by the user at runtime and stored in the variable named 'radius'. Area of circle is calculated using the formula
Area of circle = 3.14 * radius * radius
There are two ways to accomplish the task of calculating and printing the area. First one is to store the result in a variable and then print its value. Second one is to calculate the area inside printf() statement itself and print. Here, we have used the second one.
printf("\nArea of circle = %f",3.14 * radius * radius);
Here, first of all, (3.14 * radius * radius) operation is performed and is replaced by the value obtained. And then, that value is printed.

Similarly, circumference of circle is calculated using the formula:
Circumference of circle = 2 * 3.14 * radius