#include <iostream>
using namespace std;
int main()
{
// 1*2*3*4*5*6*7*8*9*10 = 3628800
setlocale(LC_ALL, "Russian");
unsigned int N;
long long int Result = 1;
cin >> N;
for(int i = 1; i <= N; i++){
Result = Result * i;
}
cout << endl << Result;
return 0;
10
3628800
5
120
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Код
#include <iostream>
using namespace std;
int main()
{
// 1*2*3*4*5*6*7*8*9*10 = 3628800
setlocale(LC_ALL, "Russian");
unsigned int N;
long long int Result = 1;
cin >> N;
for(int i = 1; i <= N; i++){
Result = Result * i;
}
cout << endl << Result;
return 0;
}
Проверка
10
3628800
5
120