Var i,x:integer; m:array[10..20] of integer; begin randomize; for i:=10 to 20 do m[i]:=random(11)+10; for i:=10 to 20 do write(m[i],' '); writeln; x:=m[10]; m[10]:=m[20]; m[20]:=x; for i:=10 to 20 do write(m[i],' '); writeln; end.
2)
var max,min,i,x:integer; m:array[10..20] of integer; begin min:=10; max:=10; randomize; for i:=10 to 20 do m[i]:=random(100)+1; for i:=10 to 20 do write(m[i],' '); writeln; for i:=10 to 20 do begin if m[i]<m[min] then min:=i; if m[i]>m[max] then max:=i; end; x:=m[min]; m[min]:=m[max]; m[max]:=x; for i:=10 to 20 do write(m[i],' '); writeln; end.
i,x:integer;
m:array[10..20] of integer;
begin
randomize;
for i:=10 to 20 do m[i]:=random(11)+10;
for i:=10 to 20 do write(m[i],' ');
writeln;
x:=m[10];
m[10]:=m[20];
m[20]:=x;
for i:=10 to 20 do write(m[i],' ');
writeln;
end.
2)
var
max,min,i,x:integer;
m:array[10..20] of integer;
begin
min:=10;
max:=10;
randomize;
for i:=10 to 20 do m[i]:=random(100)+1;
for i:=10 to 20 do write(m[i],' ');
writeln;
for i:=10 to 20 do begin if m[i]<m[min] then min:=i;
if m[i]>m[max] then max:=i;
end;
x:=m[min];
m[min]:=m[max];
m[max]:=x;
for i:=10 to 20 do write(m[i],' ');
writeln;
end.
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int a1, a2, a3;
int b1, b2, b3;
int k, w;
printf("Введите k и w: ");
scanf_s("%d%d", &k, &w);
printf("%d %d\n", k, w);
scanf_s("%d%d%d%d%d%d", &a1, &b1, &a2, &b2, &a3, &b3);
if ((a1 <= 10 && a1 >= 1) || (a2 <= 10 && a2 >= 1) || (a3 <= 10 && a3 >= 1) || (b1 <= 15 && b1 >= 1) || (b2 <= 15 && b2 >= 1) || (b3 <= 15 && b3 >= 1)) {
printf("1 <= a <= 10 и 1 <= b <= 15");
return 0;
}
if ((a1 + a2 + a3) > w) {
printf("Error sum a > w\n");
printf("NO");
return 0;
} else
if ((b1 + b2 + b3) > k) {
printf("Error sum b > k\n");
printf("NO");
return 0;
} else
if (k < 1 || k > 15) {
printf("Error k\n");
printf("NO");
return 0;
} else
if (w < 1 || w > 30) {
printf("Error w\n");
printf("NO");
return 0;
} else
printf("YES");
return 0;
}