Skip to content

Instantly share code, notes, and snippets.

@ivanursul
Last active October 18, 2017 19:37
Show Gist options
  • Save ivanursul/d98691bb4e2d28d0288273f4a06187fe to your computer and use it in GitHub Desktop.
Save ivanursul/d98691bb4e2d28d0288273f4a06187fe to your computer and use it in GitHub Desktop.
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