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.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n: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
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n: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
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
Câu 1:
var i,n:integer;
s:longint;
begin
Write('n = ');readln(n)
for i:=1 to n do
s:=s+2*i+1;
write('tong la: ',s);
readln
end.
Câu 2
Bài 5:
Var b:array:[1..1000] of integer;
i,n,max:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(b[i]);
End;
Write('Cac phan tu am la: ');
For i:=1 to n dko
if b[i]<0 then write(b[i]:8);
writeln;
max:=b[1];
For i:=2 to n do
If b[i] > max then max:=b[i];
write('So lon nhat la ',max);
Readln
End.
2:
uses crt;
var a:array[1..100]of integer;
n,i: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
if a[i]<0 then write(i:4);
readln;
end.
Uses crt;
var n,i,max,min: integer;
a: array[1..100] of longint;
begin clrscr;
readln(n);
for i:=1 to n do read(a[i]); readln;
max:=a[1];
for i:=1 to n do if(max<a[i]) then max:=a[i];
writeln(max);
min:=a[1];
for i:=1 to n do if(min>a[i]) then min:=a[i];
writeln(min);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,tb:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
writeln(tb/n:4:2);
readln;
end.
program im_14424;
uses crt;
var A: array[1..9999999] of interger;
S,P : integer;
i,n: byte;
begin
clrscr;
S:=0;
P:=0;
for i:=1 to n do
begin
write('Nhap vao phan tu thu: ',i,);
readln(A[i]);
S:=S+A[i]
P:=P*A[i]
end;
writeln(S);
write(P);
readln;
end.
program TongSoChiaHetCho5;
var
n, i, x, tong: integer;
begin
write('Nhap so phan tu n: ');
readln(n);
tong := 0;
for i := 1 to n do
begin
write('Nhap phan tu thu ', i, ': ');
readln(x);
if (x > 0) and (x mod 5 = 0) then
tong := tong + x;
end;
writeln('Tong cac so lon hon 0 va chia het cho 5 la: ', tong);
readln;
end.
Program HOC24;
var i,n,k,d: integer;
a: array[1..1000] of integer;
begin
readln(n,k);
for i:=1 to n do read(a[i]); readln;
d:=0;
for i:=1 to n do if a[i]=k then d:=d+1;
write(d);
readln
end.