Visual Studio 2017
Z4)
#include "stdafx.h"
#include
#include
using namespace std;
int main()
{
setlocale(LC_ALL, "Rus");
double A[10], B[10], C[10];
for (int i = 0; i < 10; i++) {
A[i] = sin(i);
B[i] = sqrt(i);
C[i] = A[i] + B[i];
}
cout << "A- ";<br> for (int i = 0; i < 10; i++) cout << fixed << setprecision(4) << A[i] << " ";<br>
cout << endl << "B- ";<br> for (int i = 0; i < 10; i++) cout << B[i] << " ";<br>
cout << endl << "C- ";<br> for (int i = 0; i < 10; i++) cout << C[i] << " ";<br> cout << endl << endl;<br> double kol = 0;
for (int i = 0; i < 10; i++) if (A[i] > 0) kol++;
cout << "Количество полож. елемент в А= " << fixed << setprecision(0)<< kol << endl;<br> kol = 0;
for (int i = 0; i < 10; i++)
if (B[i] > 1, 7 && B[i] < 2.6)
kol += B[i];
cout << "Средн. арифм. в B= " << fixed << setprecision(4) << kol / 10 << endl << "Измененный С- ";<br>
for (int i = 0; i < 10; i++) {
if (C[i] >= 0)
C[i] *= 2;
else C[i]--;
cout << C[i]<<" ";<br> }
double max=0, min=C[0];
for (int i = 0; i < 10; i++) {
if (C[i] > max) max = C[i];
if (C[i] < min) min = C[i];
}
cout << endl << "Минимальный в С= " << min << endl << "Максимальный в С= " << max << endl;<br>
system("pause");
}
Z5)
#include "stdafx.h"
#include
using namespace std;
bool Simple(int N) {
bool result = true;
for (int k = 2; k <= N / 2; k++)<br> if (N%k == 0) result = false;
return result;
}
int main() {
setlocale(0, "rus");
cout << "Введите размер массива: "; int n; cin >> n;
int* m = new int[n];
int i = 0, num = 1;
bool e = false;
while (e != true) {
if (Simple(num)) {
m[i] = num;
i++;
}
num++;
if (i == n) e = true;
}
for (i = 0; i cout << endl;<br> for (int i = 0; i < n; i++) if (m[i] % 10 == 3) cout << m[i]<<" ";<br> cout << endl;<br> system("pause");
delete[] m;
return 0;
}