1.
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
long long a[20], i, sum = 0, sum1 = 0;
for(i = 0; i < 20; i++)
cin >> a[i];
if(a[i] < 0)
sum += a[i];
sum1++;
}
cout << a[i] << " ";
cout << endl;
cout << sum << " " << sum1 << " " << sum / sum1 << endl;
return 0;
2.
long long b[6][4], i, j;
for(i = 0; i < 6; i++)
for(j = 0; j < 4; j++)
b[i][j] = rand() % 100;
if(b[i][j] > 9 && b[i][j] < 100)
b[i][j] = 10;
cout << b[i][j] << " ";
Объяснение:
using namespace std;
int main(){ setlocale(0, ""); double x, y, a, b, xk, xn, dx; a = 1.4; b = 2.5; cout << "Ââåäèòå xn,xk, dx = " << endl; cin >> xn; cin >> xk; cin >> dx; x = xn; cout << "Tabl" << endl; cout << "+-----------+" << endl; cout << "¦ x ¦ y ¦" << endl; while (x <= xk) { y = (log10(a*x*x+b))/(a*x+1); cout << "+-----+-----¦" << endl; cout.setf(ios::fixed); cout.precision(3); cout << "¦" << x << "¦"<< y << "¦" << endl; x = x + dx; } cout << "+-----------+"; system("pause");}
1.
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
long long a[20], i, sum = 0, sum1 = 0;
for(i = 0; i < 20; i++)
{
cin >> a[i];
if(a[i] < 0)
{
sum += a[i];
sum1++;
}
}
for(i = 0; i < 20; i++)
cout << a[i] << " ";
cout << endl;
cout << sum << " " << sum1 << " " << sum / sum1 << endl;
return 0;
}
2.
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
long long b[6][4], i, j;
for(i = 0; i < 6; i++)
{
for(j = 0; j < 4; j++)
{
b[i][j] = rand() % 100;
if(b[i][j] > 9 && b[i][j] < 100)
b[i][j] = 10;
cout << b[i][j] << " ";
}
cout << endl;
}
return 0;
}
Объяснение: