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.
uses crt;
var a,b,c,max,t:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
t:=a+b+c;
writeln('Tong cua 3 so la: ',t);
writeln('So lon nhat trong 3 so la: ',max);
readln;
end.
program tim_chu_so;
uses crt;
var i,n,csln:longint;
k:integer;
a:array[1..1000]of longint;
st:string;
begin
clrscr;
write('nhap so n:');readln(n);
str(n,st);
val(st,a[i]);
csln:=a[1];
for i:=1 to length(st) do
if csln<a[i] then csln:=a[i];
writeln('chu so lon nhat cua so ',n,' la:',csln);
readln;
end.
Câu 1:
uses crt;
var n,i,d,x,y,max:integer;
st:string;
begin
clrscr;
write('Nhap n='); readln(n);
str(n,st);
d:=length(st);
max:=0;
for i:=1 to d do
begin
val(st[i],x,y);
if max<x then max:=x;
end;
writeln('Chu so lon nhat la: ',max);
readln;
end.
Đề 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('Nhap 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.
Đề 2:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap 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.
program Tim_so;
var
n, i, max, count: integer;
arr: array[1..100] of integer;
begin
writeln('Nhap vao so n: ');
readln(n);
writeln('Nhap vao day so: ');
for i := 1 to n do
begin
readln(arr[i]);
end;
max := arr[1];
count := 1;
for i := 2 to n do
begin
if(arr[i] > max) then
begin
max := arr[i];
count := 1;
end
else if(arr[i] = max) then
begin
count := count + 1;
end;
end;
writeln('So lon nhat la: ', max);
writeln('Co ', count, ' so lon nhat trong day.');
readln;
end.
a)
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap 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.
b)
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('Nhap 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.
Program HOC24;
var a: array[1..32000] of integer;
i,max,min,n: integer;
begin
write('Nhap so phan tu N: '); readln(N);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
max:=a[1]; min:=a[1];
for i:=1 to n do
begin
if a[i]>max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('So nho nhat la :',max);
write('So lon nhat la: ',min);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
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;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln('So so chan la: ',dem);
readln;
end.
program b1;
uses crt;
var a:array[1..100] of integer; i,n,max,min:integer;
begin
clrscr;
write('Nhap vao so nguyen n:');
readln(n);
for i:=1 to n do
readln(a[i]);
min:=a[1];
max:=a[1];
for i:=2 to n do
begin
if(a[i]<min) then min:=a[i];
if(a[i]>max) then max:=a[i];
end;
writeln(' gia tri lon nhat = ',max);
writeln(' gia tri nho nhat = ',min);
readln;
end.
Tham khảo!
uses crt;
var a,b,ucln,bcnn,i:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
ucln:=1;
if a<b then begin
for i:=1 to a do
if (a mod i=0) and (b mod i=0) then begin
if ucln<i then ucln:=i;
end;
end else begin
for i:=1 to b do
if (a mod i=0) and (b mod i=0) then
begin
if ucln<i then ucln:=i;
end;
end;
bcnn:=a*b;
for i:=a*b-1 downto 1 do
if (i mod a=0) and (i mod b=0) then
begin
if bcnn>i then bcnn:=i;
end;
writeln('Uoc chung lon nhat la: ',ucln);
writeln('Boi chung nho nhat la: ',bcnn);
readln;
end.
Tham khảo: