Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- #include <conio.h>
- #include <locale.h>
- using namespace std;
- void genmas1(int k, int a, int b, int *x) {
- int i, q = 0, w = 0;;
- for (i = 0; i < k; i++) {
- x[i] = rand() % (b - a + 1) + a;
- cout << x[i] << " ";
- }
- cout << endl;
- cout << "Число Марселя:" << endl;
- for (int i = 0; i <= k; i++) {
- for (int j = 2; j < sqrt(x[i]);j++) {
- if (x[i] % j != 0) { // проверка на простое число
- cout << " " <<x[i];
- }
- }
- }
- }
- int main()
- {
- srand(time(NULL));
- int a[15];
- setlocale(LC_ALL, "Russian");
- cout << "a:";
- genmas1(15, 0, 100, a);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement