Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n = 7;
- int m = 8;
- const int N = 100;
- int s[N][N];
- bool is = true;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- s[i][j] = rand() % 10;
- }
- }
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- for (int x = 2; x < sqrt(s[i][j]); x++) {
- if (s[i][j] % x == 0) {
- is = false;
- break;
- }
- }
- }
- }
- if (is)
- {
- cout << "true" << endl;
- }
- else
- {
- cout << "false" << endl;
- }
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- cout << s[i][j] << " ";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement