/*计算圆的面积*/ #include<stdio.h> int main(void) { double R,S;/*R为圆的半径,S为圆的面积*/ printf("Enter R:"); scanf("%lf",&R); if(R<=0){/*判断输入的值是否正确*/ printf("Enter is wrong !"); } else{ S=3.14*R*R; } printf("S=%.2lf ",S); return 0; }
/*计算圆的面积*/ #include<stdio.h> int main(void) { double R,S;/*R为圆的半径,S为圆的面积*/ printf("Enter R:"); scanf("%lf",&R); if(R<=0){/*判断输入的值是否正确*/ printf("Enter is wrong !"); } else{ S=3.14*R*R; } printf("S=%.2lf ",S); return 0; }