SHARE
TWEET

Expoentielle

rekkylaws Oct 23rd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. //programme exponentielle avec précision
  5. void main()
  6. {
  7.     float e,x,n,j,i,fact;
  8.     printf("Avec quelle prĂ©cision (n) voulez vous calculer e ?\n");   
  9.     scanf("%f",&n);
  10.     printf("Quelle valeur de x (e^x) voulez vous ?\n");
  11.     scanf("%f",&x);
  12.     e=0;
  13.     for(i=1;i<n;i++)
  14.     {
  15.         fact=1;
  16.         for(j=1;j<i;j++)
  17.         {
  18.             fact=fact*j;
  19.         }
  20.         e=e+(pow(x,i)/fact);
  21.     }
  22.     e=e/x;
  23.     printf("La valeur de e^%f est %f\n\n",x,e);
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top