Untitled
unknown
c_cpp
8 months ago
741 B
0
Indexable
Never
#include <iostream> using namespace std; void fill(int m[], int n[], const int size, int a, int b) { for (int i = 0; i < size; i++) { m[i] = rand() % (b - a + 1) + a; n[i] = rand() % (b - a + 1) + a; } for (int i = 0; i < size; i++) { cout << m[i] << ' '; } cout << endl; for (int i = 0; i < size; i++) { cout << n[i] << ' '; } cout << endl; } void summ(int m[], int n[], const int size) { int tas[10]; for (int i = 0; i < size; i++) { tas[i] = m[i] + n[i]; } for (int i = 0; i < size; i++) { cout << tas[i] << " "; } } int main() { srand(time(0)); const int N = 10; int mas[N], a, b, nas[N]; int n = 10; cin >> a >> b; fill(mas, nas, n, a, b); summ(mas, nas, n); }
Leave a Comment