Home > Article > Backend Development > C language implements inputting the radius of a circle to calculate the area of the circle

Formula used:
Perimeter formula: C=2πr
Area formula: S=πr²
Specific code:
#include<stdio.h>
int main()
{
float r,PI;
PI = 3.14159;
printf("请输入圆的半径:\n");
scanf("%f", &r);
printf("圆的周长为%.7f\n圆的面积为%.7f\n", 2 * PI*r, PI*r*r);
}Recommended tutorial: c language tutorial
The above is the detailed content of C language implements inputting the radius of a circle to calculate the area of the circle. For more information, please follow other related articles on the PHP Chinese website!