var
arr:array[1..1000] of integer;
i,N:integer;
max:integer;
begin
max:=1;
write('Укажите кол-во эл-ов - ');
read(N);
for i:=1 to N do//Присваивание и вывод массива
begin
arr[i]:=1+random(100);
write(arr[i],' ');
if arr[i]>max then max:=arr[i];
end;
writeln;
writeln('Максимальный эл-т - ',max);
for i:=1 to N do//Увеличение чет. эл-ов
begin
if arr[i] mod 2=0 then arr[i]:=arr[i]+max;
write(arr[i],' ');
end;
end.
Объяснение:
Var
N,A:integer;
Begin
Write('N = ');Read(N);
A:=0;
While N>0 do
Begin
if (N mod 10) > A then A:= N mod 10;
N:=N div 10;
End;
Write(A)
End.
Var
N,A,B:integer;
C:boolean;
Begin
Write('N = ');Read(N);
A:=-1;
B:=-2;
C:=false;
While N>0 do
Begin
if A=B then C:=true;
if N>0 then
Begin
A:=N mod 10;
N:=N div 10;
End;
if A=B then C:=true;
if N>0 then
Begin
B:=N mod 10;
N:=N div 10;
End;
End;
if A=B then C:=true;
if C then Write('Есть')
else Write('Нет')
End.
Подробнее - на -
#include <iostream>
using namespace std;
int main() {
int x = 5, y;
while (x < 2000) {
if (x <= 75) {
y = x * x;
}
else if (75 < x <= 225) {
y = 78 * x;
}
else if (x > 225) {
y = 576 * x + 10;
}
cout << "X=" << x << "||" << "Y=" << y << endl;
x += 20;
}
return 0;
}