var a:array [1..5] of integer; i:integer;begin randomize; for i:=1 to 5 do begin a[i]:=random(31)-15; write (a[i]:4); end; writeln; for i:=1 to 5 do begin a[i]:=a[i]*2; write (a[i]:4); end; writeln; readln;end.C++:#include <iostream>#include <ctime>#include <cstdlib>using namespace std;int main(){ int a[5]; srand (time(NULL)); for (int i = 0; i<5; i++) { a[i] = rand()%15-15; cout <<a[i] <<" "; } cout <<endl; for (int i = 0; i<5; i++) { a[i]*=2; cout <<a[i] <<" "; } return 0;
var a:array [1..5] of integer; i:integer;begin randomize; for i:=1 to 5 do begin a[i]:=random(31)-15; write (a[i]:4); end; writeln; for i:=1 to 5 do begin a[i]:=a[i]*2; write (a[i]:4); end; writeln; readln;end.C++:#include <iostream>#include <ctime>#include <cstdlib>using namespace std;int main(){ int a[5]; srand (time(NULL)); for (int i = 0; i<5; i++) { a[i] = rand()%15-15; cout <<a[i] <<" "; } cout <<endl; for (int i = 0; i<5; i++) { a[i]*=2; cout <<a[i] <<" "; } return 0;
Объяснение: