Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h> // для time()
- #include <stdlib.h> // для rand()
- using namespace std;
- int fact(int number) {
- int result = 1;
- for (int i = 1; i <= number; i++) {
- result *= i;
- }
- return result;
- }
- int main() {
- setlocale(LC_ALL, "ru");
- int n;
- cout << "Введите число: ";
- cin >> n;
- cout << "Факториал числа: " << fact(n) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement