Mathc initiation/Fichiers c : c02f
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c02f.c |
---|
/* ------------------------------ */
/* Save as : c02f.c */
/* ------------------------------ */
#include <stdio.h>
#include <ctype.h>
#include <math.h>
/* ------------------------------ */
#include "z_s.h"
/* ------------------------------ */
int main(void)
{
double x;
double n;
clrscrn();
x = .5;
printf(" exp(%.1f) = %+6.3f exp(x) \n", x, exp(x));
printf(" ln(%.1f) = %+6.3f log(x) \n", x, log(x));
printf(" log(%.1f) = %+6.3f log10(x)\n", x, log10(x));
printf("\n\n");
x= 2.; n=2. ;
printf(" %3.0f**2 = %+-7.f pow(2.,2.)\n",x,pow(x,n));
x= 4.; n=1./2.;
printf(" %3.0f**(1/2) = %+-7.f pow(4.,1./2.)\n",x,pow(x,n));
x=27.; n=1./3.;
printf(" %3.0f**(1/3) = %+-7.f pow(27.,1./3.)\n",x,pow(x,n));
stop();
return 0;
}
/* ------------------------------ */
/* ------------------------------ */
Les fonctions exponentielles et logarithmes.
Exemple de sortie écran :
exp(0.5) = +1.649 exp(x)
ln(0.5) = -0.693 log(x)
log(0.5) = -0.301 log10(x)
2**2 = +4 pow(2.,2.)
4**(1/2) = +2 pow(4.,1./2.)
27**(1/3) = +3 pow(27.,1./3.)
Press return to continue.