Program n1;
var q,w,e:integer;
a:array [1..25]of integer;
begin
for q:=1 to 25 do begin
a[q]:=random(30);
write(a[q],' ');
end;
end.
Program n2;
var q:integer;
a:array [1..30]of integer;
begin
a[1]:=5;
writeln(a[1],' ');
for q:=2 to 26 do begin
a[q]:=a[q-1]+5;
writeln(a[q],' ');
end;
end.
Program n3;
var q:integer;
a:array [1..15]of integer;
begin
for q:=1 to 15 do begin
a[q]:=random(30)-50;
writeln(a[q],' ');
end;
end.
Объяснение:
===== C++ 17 =====
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int nm = 12, nd = 28;
float t2009[12][28], t2010[12][28], pt[12][28];
float dT[nm][2] ={{-7.3,-4},{-9.8, -9.1},{-4.4, 2.6},{2.2,11.3},
{7.7,18.6},{12.1,22},{14.4,24.3},{12.5,21.9},
{7.4,15.7},{2.2,8.7},{-3.3,0.9},{-7.6,-3}};
srand(time(NULL));
for(int m = 0; m < nm; m++)
{
float k = (dT[m][1] - dT[m][0])/RAND_MAX;
for(int d =0; d < nd; d++)
{
t2009[m][d] = rand() * k + dT[m][0];
t2010[m][d] = rand() * k + dT[m][0];
pt[m][d] = t2010[m][d] / t2009[m][d] * 100;
}
}
cout << "2009\n";
for(int m = 0; m < nm; m++)
{
for(int d =0; d < nd; d++)
cout << fixed << setw(5) << setprecision(1) << t2009[m][d];
cout << endl;
}
cout << "2010\n";
for(int m = 0; m < nm; m++)
{
for(int d =0; d < nd; d++)
cout << fixed << setw(5) << setprecision(1) << t2010[m][d];
cout << endl;
}
cout << "PERCENTS\n";
for(int m = 0; m < nm; m++)
{
for(int d =0; d < nd; d++)
cout << fixed << setw(5) << setprecision(0) << pt[m][d];
cout << endl;
}
return 0;
}