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 n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 6=0 then s:=s+i;
writeln(s);
readln;
end.
Bài 2:
uses crt;
var a,b,c,ucln,i:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
while a<>b do
begin
if a>b then a:=a-b
else b:=b-a;
end;
ucln:=a;
while ucln<>c do
begin
if ucln>c then ucln:=ucln-c
else c:=c-ucln;
end;
writeln(ucln);
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.
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.
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:array[1..100]of integer;
i,n,t,ln,nn:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
ln:=a[1];
nn:=a[1];
t:=0;
for i:=1 to n do
begin
if ln<a[i] then ln:=a[i];
if nn>a[i] then nn:=a[i];
t:=t+a[i];
end;
writeln(ln);
writeln(nn);
writeln(t);
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
var n,i,max,min,s: integer;
a: array[1..100] of integer;
begin
readln(n);
for i:=1 to n do begin
readln(a[i]);
s:=s+a[i];
end;
max:=a[1]; min:=a[1];
for i:=2 to n do begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('MAX=',max,' | MIN=',min);
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' '); writeln;
write('Tong = ',s);
readln
end.
var a:[array] of integer;
i,n,max,min,s:integer;
begin
write('Nhap so luong so n = ');readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
end;
max:=a[1];
min:=a[1];
s:=0;
for i:=1 to n do
begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
s:=s+a[i];
end;
writeln('So lon nhat la ',max);
writeln('So nho nhat la ',min);
writeln('Tong cac phan tu trong day la ',s);
writeln('Cac so chia het cho 2 la: ');
for i:=1 to n do
if a[i] mod 2 = 0 then write(a[i],' ');
readln;
end.
program cau_1;
uses crt;
var a,b,s:integer;
begin
clrscr;
write('nhap so a:'); readln(a);
writeln('nhap so b:');readln(b);
s:=0;
s:=a+b;
writeln('tong hai so a, b la:',s);
readln;
end.
Python:
a=int(input('a= '))
b=int(input('b= '))
if a<b:
print('a la so be nhat')
if a>b:
print('b la so be nhat')
else:
print('a=b')
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
if (a<b) then write(a)
else write(b);
readln;
end.