Code:
#include <stdio.h>
#include <math.h>
int main(){
int i;
float a = 1;
float b = a/sqrt(2);
float t = a / 4;
float x = a;
float y;
float p;
for (i = 1; i <= 19; i++)
{
y = a;
a = (a+b)/2;
b = sqrt(b*y);
t = t-x*(a-y)*(a-y);
x = 2*x;
}
p = (a+b)*(a+b)/(4*t);
printf("%.1000000f",p);
getch();
return 0;
}
#include <stdio.h>
#include <math.h>
int main(){
int i;
float a = 1;
float b = a/sqrt(2);
float t = a / 4;
float x = a;
float y;
float p;
for (i = 1; i <= 19; i++)
{
y = a;
a = (a+b)/2;
b = sqrt(b*y);
t = t-x*(a-y)*(a-y);
x = 2*x;
}
p = (a+b)*(a+b)/(4*t);
printf("%.1000000f",p);
getch();
return 0;
}
problem je sto su prvih 16 decima tocnih a sve ostalo su nule...unaprijed hvala na svakoj mogucoj pomoci...
[Ovu poruku je menjao un4given_2 dana 09.10.2006. u 23:43 GMT+1]