Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

C/C++: calculer le logarithme naturel d’un nombre

 calcul
{filelink=14002}

#include
<math.h>
#include <stdio.h>
 
int main(void)
{
double x[ ] = { 1E-100, 0.5, 2, exp(1), 10, 1E+100 };
 
puts("       x           log(x)           log10(x)n"
     " ----------------------------------------------");
for ( int i = 0; i < sizeof(x) / sizeof(x[0]); ++i )
{
  printf("%#10.3G  %+17.10G %+17.10Gn",
         x[i],  log(x[i]), log10(x[i]) );
}
 
  return 0;
}

No comments yet.

Leave a Comment