実数xと整数nをキーボードから入力し、1つのdo文を用いてべき乗(xのn乗)とnの階乗を計算し、x、n、べき乗を出力せよ。
int x; int n; int pow = 1; int fact = 1; cin >> x >> n; for (int i = 1; i <= n; i++) { pow *= x; fact *= i; } cout << x << ' ' << n << ' ' << pow << endl;
実数xと整数nをキーボードから入力し、1つのdo文を用いてべき乗(xのn乗)とnの階乗を計算し、x、n、べき乗を出力せよ。
int x; int n; int pow = 1; int fact = 1; cin >> x >> n; for (int i = 1; i <= n; i++) { pow *= x; fact *= i; } cout << x << ' ' << n << ' ' << pow << endl;
Generate
More than just a code generator. A tool that helps you with a wide range of tasks. All in one place.
Function from Description
Text Description to SQL Command
Translate Languages
Generate HTML from Description
Code to Explanation
Fix invalid Code
Get Test for Code
Class from Description
Regex from Description
Regex to Explanation
Git Command from Description
Linux Command
Function from Docstring
Add typing to code
Get Language from Code
Time complexity
CSS from Description
Meta Tags from Description