Created
March 15, 2023 07:59
-
-
Save modos/5c28d2cc283fb41b99e5abcabd3fc919 to your computer and use it in GitHub Desktop.
محاسبهی پیچیده
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Online C++ Compiler. | |
Code, Compile, Run and Debug C++ program online. | |
Write your code in this editor and press "Run" button to compile and execute it. | |
*******************************************************************************/ | |
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
int main() | |
{ | |
int factorials[11] = {1,1,2,6, 24, 120, 720, 5040, 40320, 362880, 3628800}; | |
int n; | |
int x; | |
int a; | |
int result; | |
cin >> a >> x >> n; | |
for (int i = 0; i <= n; i++) { | |
result += (factorials[n] / factorials[n - i] / factorials[i]) * pow(x, i) * pow(a, n - i); | |
} | |
cout << result; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment