Advertisement
rekkylaws

Expoentielle

Oct 23rd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement