C语言计算圆面积:使用函数和 pow() 函数
#include <stdio.h> #include <math.h>
float area(float radius);
int main() { float r; printf("请输入圆的半径:"); scanf("%f", &r); printf("圆的面积为:%.2f\n", area(r)); return 0; }
float area(float radius) { float pi = 3.14; float r_square = pow(radius, 2); return pi * r_square; }
原文地址: https://www.cveoy.top/t/topic/nBZC 著作权归作者所有。请勿转载和采集!