MR2 2.0 N/A & Mk1 1.2Clio
an assignment for uni, finished just need to compile it and test it.
problem is that im at home and my version of borland is massivly different from one at uni and i cant figure it out lol and its for tomorrow.
all i need is the exe back? prob isnt best place to post it but hopefully someone on here can do it.
this is the code
If anyone could do it id be soooo greatfull?
Thanks
MJ
problem is that im at home and my version of borland is massivly different from one at uni and i cant figure it out lol and its for tomorrow.
all i need is the exe back? prob isnt best place to post it but hopefully someone on here can do it.
this is the code
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
float estimate=0,twoadder=1,sign=1,pow3=1;
int k,n;
char again;
estimate = ( estimate + ( 2 * sqrt(3) ));
oncemore:
printf("Please input number of iterations of pi you would like:\n\n");
scanf("%d",&n);
for(k = 1; k<=n ; k++ )
{
if(k%2==0)
sign=1;
else
sign=-1;
estimate=estimate+(sign*(1/(pow3*twoadder)));
pow3=pow3*3;
twoadder=twoadder+2;
}
printf("\nEstimate: \n%f",estimate);
printf("\nLib Value: \n%f",M_PI);
printf("\nDiff: \n%f",estimate-M_PI);
printf("\n\nEnter Another??\n(yes or no)");
scanf("%c",&again);
if (again=="yes")
goto oncemore;
}
If anyone could do it id be soooo greatfull?
Thanks
MJ
Last edited: