1.3.1提高实数精度的范例

#include <stdio.h>
#include <math.h>
#define M_PI 3.1415926
int num_props;
float x,y;
int i;
double calc;
int years;
int main()
{
	scanf("%d",&num_props);
	for(i=1;i<num_props;i++)
	{
		scanf("%f %f",&x,&y);
		calc=(x*x+y*y)*M_PI/2/50;//本题限制的一种计算半圆面积的一种方法
		years=ceil(calc);//库函数
		printf("Property %d: This property will begin eroding in year %d.
",i,years);
	}
	printf("END OF OUTPUT.
");
}

原文地址:https://www.cnblogs.com/sxy201658506207/p/7586437.html