BUPT-homework/semester1/pset1/4-pi.c

16 lines
273 B
C
Raw Permalink Normal View History

2021-09-23 16:18:59 +08:00
#include <stdio.h>
const double PI = 3.14159265;
int main(void) {
// initialize values
double radius;
scanf("%lf", &radius);
// print answer
printf("The perimeter is %.4lf, the area is %.4lf.\n", PI * radius * 2,
PI * radius * radius);
return 0;
}