C language implements inputting the radius of a circle to calculate the area of ​​the circle

王林
Release: 2020-05-11 11:17:49
Original
33983 people have browsed it

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);
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template