c語言編........
已知某數answe=3.14159,要求從鍵盤上輸入數據,直到輸入數據非常接近answer(之間的誤差為0.0001)時,打印輸出結果為close enough
最佳回答:
#include "stdio.h"
void main ()
{
double answer = 3.14159 ,a;
printf ("Please enter a data\n");
scanf ("%lf",&a);
if ((a - answer >= - 0.0001) && (a - answer <= 0.0001))
{
printf ("Close enough\n");
}
else
{
printf ("not close enough\n");
}
}