1) Program n1; const n=10; var a: array [1..n] of integer; i,sum: integer; begin randomize; sum:=0; for i:=1 to n do a[i]:=random(100)+1; for i:=1 to n do sum:=sum+a[i]; writeln('сумма: ',sum); end. 2) Program n2; const n=10; var a: array [1..n] of integer; i,sum,j,temp: integer; begin randomize; writeln('исходный массив'); for i:=1 to n do begin a[i]:=random(100)+1; write(a[i],' '); end; writeln; writeln('полученный массив: '); for i:=1 to n do for j:=i to n do if a[j]<a[i] then begin temp:=a[i]; a[i]:=a[j]; a[j]:=temp end; for i:=1 to n do write(a[i],' '); end.
Program n1;
const n=10;
var a: array [1..n] of integer;
i,sum: integer;
begin
randomize;
sum:=0;
for i:=1 to n do a[i]:=random(100)+1;
for i:=1 to n do sum:=sum+a[i];
writeln('сумма: ',sum);
end.
2)
Program n2;
const n=10;
var a: array [1..n] of integer;
i,sum,j,temp: integer;
begin
randomize;
writeln('исходный массив');
for i:=1 to n do
begin
a[i]:=random(100)+1;
write(a[i],' ');
end;
writeln;
writeln('полученный массив: ');
for i:=1 to n do
for j:=i to n do
if a[j]<a[i] then
begin
temp:=a[i];
a[i]:=a[j];
a[j]:=temp
end;
for i:=1 to n do write(a[i],' ');
end.
public static void main(String args[]){
java.util.Scanner in = new java.util.Scanner(System.in);
String string = in.nextLine(); char chars[] = new char[4];
chars[0] = in.nextLine().charAt(0); chars[2] = in.nextLine().charAt(0);
for(int sChar = 0; sChar<string.length(); sChar++)
if(string.charAt(sChar)==chars[0])chars[1]++;
else if(string.charAt(sChar)==chars[2])chars[3]++;
System.out.print("\n"+(chars[1]==chars[3]?chars[0]+""+chars[2]:chars[1]>chars[3]?chars[0]:chars[2]));
}
}