Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int n = 0, m = 0, placements = 0, i = 0, i1 = 0, i2 = 0;
- cout << "Данная программа вычисляет число размещений из N по M." << endl;
- cout << "N и M числа натуральные, при этом N больше M." << endl;
- cout << "Введите N: ";
- cin >> n;
- cout << "Введите M: ";
- cin >> m;
- placements = n;
- i1 = n - 1;
- i2 = n - m + 1;
- for (i=i1; i>=i2; i--)
- {
- n = n - 1;
- placements = placements * n;
- }
- cout << "Число размещений равно " << placements << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement