program maximal;
uses wincrt;
type
tabint =array[1..100] of integer;
var
M: array[1..100]of integer;
nilai: tabint;
n,i:integer;
max,temp:integer;
function maxtab(n:integer):integer;
begin
write('masukkan jumlah bilangan =');readln(M[i]);
for i:= 1 to n do
begin
if(M[i])>max then
max:=M[i];
end;
writeln('Nilai maximum adalah:',max);
for i:=1 to n do
begin
if (i mod 2=1) then
begin
temp:= M[i];
M[i]:= M[i+1];
M[i+1]:= temp;
end;
writeln('M[i]');
end;
end.
uses wincrt;
type
tabint =array[1..100] of integer;
var
M: array[1..100]of integer;
nilai: tabint;
n,i:integer;
max,temp:integer;
function maxtab(n:integer):integer;
begin
write('masukkan jumlah bilangan =');readln(M[i]);
for i:= 1 to n do
begin
if(M[i])>max then
max:=M[i];
end;
writeln('Nilai maximum adalah:',max);
for i:=1 to n do
begin
if (i mod 2=1) then
begin
temp:= M[i];
M[i]:= M[i+1];
M[i+1]:= temp;
end;
writeln('M[i]');
end;
end.
No comments:
Post a Comment