第3測資點我跑出來是8.99%
可是它都說我跑出來是8.98%
#include<stdio.h>
double round(double input)
{
if(input >= 0.0)
return (int)((input * 100) + 0.5) / 100.;
return (int)((input * 100) - 0.5) / 100.;
}
int main()
{
int n,m,p,i;
double x;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d",&m,&p);
x = (p-m);
x = x/m*100;
x = round(x);
if((x > 0 && x >= 10)||(x < 0 && x <= -7)) printf("%.2f%% dispose\n",x);
if((x > 0 && x < 10)||(x < 0 && x > -7)) printf("%.2f%% keep\n",x);
if(x == 0) printf("0.00%% keep\n");
}
return 0;
}
這樣打有錯嗎?