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, m,i,j;
- n = 0;
- cout << "Введите размер массива 1 ";
- cin >> n;
- int a[50];
- for (int i = 0; i < n; i++)
- {
- cout << "Введите число ";
- cin >> a[i];
- }
- cout << "Введите размер массива 2 ";
- cin >> m;
- int b[50];
- for (int i = 0; i < m; i++)
- {
- cout << "Введите число ";
- cin >> b[i];
- }
- for (i = 0; i < n; i++)
- {
- for (j = 0; j < m; j++)
- {
- if (a[i] == b[j])
- {
- int c[50];
- for (int i = 0; i < 50; i++)
- c[i] = a[i];
- cout << c[i] << " ";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement