Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Var a:array[1..100] of integer;
i,n:integer;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
Write('Cac phan tu vua nhap la ');
For i:=1 to n do
Write(a[i]:8);
Writeln;
Write('Tong cua chung la ',s);
Readln
End.
program BaiTap;
var
A: array[1..150] of integer;
N, i, sum: integer;
begin
write('Nhap so phan tu cua day A (N <= 150): ');
readln(N);
for i := 1 to N do
begin
write('Nhap phan tu thu ', i, ': ');
readln(A[i]);
end;
writeln('Day so vua nhap la:');
for i := 1 to N do
write(A[i], ' ');
writeln;
sum := 0;
for i := 1 to N do
if A[i] mod 2 = 0 then
sum := sum + A[i];
writeln('Tong cac phan tu chan trong day la: ', sum);
readln;
end.
Bài 1:
Uses crt;
var i,n,j:integer;
a,b,c:array[1..100000] of integer;
Begin
clrscr;
readln(n);
for i:= 1 to n do readln(a[i]);
for i:= 1 to n do readln(b[i]);
j:=0;
for i:= 1 to n do
Begin
inc(j);
c[j] := a[i];
inc(j);
c[j] := b[i];
end;
for i:= 1 to j do write(c[i],' ');
readln;
end.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,max,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
writeln;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('So lon nhat la: ',max);
write('Vi tri cua so lon nhat la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
writeln;
dem:=0;
for i:=1 to n do
if max=a[i] then inc(dem);
writeln('So luong phan tu lon nhat trong day la: ',dem);
readln;
end.
uses crt;
var a:array[1..100000000] of int64;
n,i,d,max:longint;
begin
clrscr;
repeat
write('Nhap so luong phan tu: '); readln(n);
if (n<=0) and (n>688886) then writeln('NHAP LAI!');
until (n>0) and (n<=688886);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Day so vua nhap: ');
for i:=1 to n do write(a[i],' ');
max:=a[1];
for i:=1 to n do if a[i]>max then max:=a[i];
writeln;
writeln('So lon nhat: ',max);
write('Vi tri cua cac so lon nhat: ');
for i:=1 to n do if a[i]=max then begin write(i,' '); inc(d) end;
writeln;
writeln('So luong so lon nhat: ',d);
readln;
end.