This program takes the user’s radius as input and figures out the area of a circle based on that. The area can be found by multiplying π r^2, where r is the radius. The number 3.1416 is used for π (Pi). The radius is entered by the user into the scanf() function, and the area is shown on the screen by the printf() function. Students can use this program to learn how to use mathematical processes in written language C.
#include <stdio.h>
int main() {
float radius, area;
printf("Enter the radius of the circle: "); // Ask the user to input radius
scanf("%f", &radius); // Read and store the radius
area = 3.1416 * radius * radius; // Calculate the area of the circle
printf("Area of the circle: %.2f\n", area); // Display the area, rounded to 2 decimal places
return 0;
}