Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <conio.h>
- double giaithua(int x) {
- double P = 1;
- for (int i = 1; i <= x; i++) {
- P = P*i;
- }
- return(P);
- }
- double myExp(double x, int n) {
- double S, h;
- S = 1;
- for (int i = 1; i<=n; i++) {
- h = pow(x,i) / giaithua(i);
- S = S + h;
- }
- return(S);
- }
- int main() {
- double a;
- a = myExp(1.5, 1000);
- printf("%lf\n", a);
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement