Skip to content

Instantly share code, notes, and snippets.

@ivanursul
Last active October 18, 2017 19:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
int alpha = 3;
int x = 5;
int i = 1;
double iterResult;
double result = 1.0
do {
numVal = 1;
for (int j = 0; j < i; j++) {
numVal *= (alpha - j);
}
int denomVal = fact(i);
iterResult = (numVal / (double) denomVal) * pow(x, i);
cout >> iterResult;
result += iterResult;
i++;
} while(iterResult != 0.0)
1 iter
numVal = 1
i = 1
numVal = numVal * (alpha - j);
numVal = 1 * (3 - 0) = 3
2 iter
numVal = 1
i = 2
numVal = numVal * (alpha - j);
numval = 1 * (3 - 0) = 3
numVal = 3 * (3 - 1) = 3 *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment