/*------------------------------------------------------- 功能:输入一个圆半径(r),当r>=0时,计算并输出圆的面积(area)和周长(circumference),否则,输出提示信息。 --------------------------------------------------------*/ #include #define PI 3.14 main() { float r,s,l; printf("please input r:\n"); scanf("%f",&r); if (r>=0) { /**********Program**********/ s = PI * r*r; l = 2*PI*r; /********** End **********/ printf("the area is %f\n",s); printf("the circumference is %f\n",l); } else printf("input error!\n"); }