Advertisement
qradmanq

dz 4.7

Nov 19th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. void getRandom(int m, int c,int i)
  5. {
  6. int S[14000];
  7. S[0] = 1;
  8. for (int n = 0; n < i; n++)
  9. {
  10. S[n + 1] = ((S[n]) * m + n) % c;
  11. cout << S[n + 1] << endl;
  12. }
  13. }
  14. int main() {
  15. setlocale(LC_ALL, "Russian");
  16. int m, i, c;
  17. cout << "Введите m";
  18. cin >> m;
  19. cout << "Введите i";
  20. cin >> i;
  21. cout << "Введите c";
  22. cin >> c;
  23. getRandom(m,c,i);
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement