#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int facto(int n){ ///fonction qui returne le factoriel
if(n==0 || n==1){ return 1;
}
else return n*facto(n-1);
}
main() {
int x,n,i=0;
float s=0.00;
printf("entrez x\n"); ///exercice de l exam precdent
scanf("%d",&x);
printf("entrez n\n");
scanf("%d",&n);
for(i=n;i>=0;i--){
s=s+pow(x,n-i)/facto(i);
}
printf("la somme est:%2f\n",s);
system("pause");
}
#include<stdlib.h>
#include<math.h>
int facto(int n){ ///fonction qui returne le factoriel
if(n==0 || n==1){ return 1;
}
else return n*facto(n-1);
}
main() {
int x,n,i=0;
float s=0.00;
printf("entrez x\n"); ///exercice de l exam precdent
scanf("%d",&x);
printf("entrez n\n");
scanf("%d",&n);
for(i=n;i>=0;i--){
s=s+pow(x,n-i)/facto(i);
}
printf("la somme est:%2f\n",s);
system("pause");
}