#define pi 3.014159
main()
{
float R,D,area,circle;
printf("please input the R:\n");
scanf("%f",&R);
printf("the D is :\n",2*R);
printf("the area is:\n",pi*R*R);
printf("the circle is:\n",pi*R*2);
}
随便些一个:
#include<stdio.h>
#define PI 3.14159
main()
{ float r,per,dia,s;
printf("please input the value of r (example r=1):");
scanf("r=%f",&r);
printf("the Diameter of circle is:%f\n",dia=2*r);
printf("the perimeter of circle is:%f\n",per=2*PI*r);
printf("the area of the circle is:%f\n",s=PI*r*r);
return 0;
}