kod eklemeyi unutmuşum.
Kod:#include <stdio.h> #include <math.h> int main() { double True_Value; double Approximate_Value; double True_Error; double term; double i; True_Value=log(2) ; //defines the true value of ln(2) printf("\n\nTrue_Value is %.15lf",True_Value); //prints the true value printf("\n\nHow many terms do you want? ",term); scanf("%lf",&term); for (i=1;i<=term;i++) { Approximate_Value=(1/i)*pow(-1,i-1); printf("\n\nApproximate_Value is %lf",Approximate_Value); } printf("\n\n\nThe program ends succesfully.\n"); getchar(); getchar(); return 1; }
#include <stdio.h>
#include <math.h>
int main()
{
double True_Value;
double Approximate_Value;
double True_Error;
double term;
double i;
double sum = 0;
True_Value=log(2) ; //defines the true value of ln(2)
printf("\n\nTrue_Value is %.15lf",True_Value); //prints the true value
printf("\n\nHow many terms do you want? ",term);
scanf("%lf",&term);
for (i=1;i<=term;i++)
{
Approximate_Value=(1/i)*pow(-1,i-1);
sum +=Approximate_Value;
printf("\n\nApproximate_Value is %lf",sum);
}
printf("\n\n\nThe program ends succesfully.\n");
getchar(); getchar();
return 1;
}
bu işini görür umarım..
Şu anda 1 üyemiz bu konuya göz atıyor. (0 kayıtlı üye ve 1 misafir.)
Bu Konuyu Paylaşın !