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;
const fi='max.out';
var f1:text;
a,b,c,max:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
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;
writeln(f1,max);
close(f1);
readln;
end.
1:
uses crt;
const fi='ketqua.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(f1,st);
close(f1);
end.
2:
uses crt;
var a,b,c,d:integer;
{----------chuong-trinh-con-----------------------}
function min(x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
{---------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
write('d='); readln(d);
writeln(min(a,min(b,min(c,d))));
readln;
end.
Program HOC24;
var a,b,c,d,max: integer;
t: longint;
begin
write('Nhap a; b; c; d: '); readln(a,b,c,d);
t:=a+b+c+d;
writeln('Tong 4 so tren la: ',t);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
if max<d then max:=d;
write('So lon nhat cua chung la: ',max);
readln
end.
*Cách khác:
uses crt;
var a,b,c,d,max:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
write('Nhap d='); readln(d);
writeln('Tong cua 4 so la: ',a+b+c+d);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
if max<d then max:=d;
writeln('Gia tri lon nhat la: ',max);
readln;
end.
Bài 3:
uses crt;
const fi='teptong.txt';
var a,b:integer;
f1:text;
begin
clrscr;
assign(f1,fi); rewrite(f1);
readln(a,b);
writeln(a+b);
writeln(f1,a+b);
close(f1);
readln;
end.
uses crt;
const fo='b.txt';
var f1:text;
a:array[1..200]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fo); rewrite(f2);
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(f1,a[i]:4);
close(f1);
readln;
end.
program cap_so_cong;
uses crt; var a: array[1..100] of integer; i, n, k: integer;
{i la bien dem, k de luu cap so} begin clrscr; write('N= ');
readln(n); for i:=1 to n do begin write('A(',i,')= ');
readln(a[i]);
end;
{Bat dau phan kiem tra} k:=a[2]-a[1]; i:=2; repeat i:= i+1; until (a[i]<>a[i-1]+k) or (i>n);
if i>n then write('Day A la mot cap so cong') else
write('Day A khong phai la mot cap so cong');
readln
end.
uses crt;
const fi='bai1.inp';
var f1:text;
a,b,c,cv,dt,p:real;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
if (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) then
begin
cv:=a+b+c;
p:=cv/2;
dt:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln(f1,'Chu vi la: ',cv:4:2);
writeln(f1,'Dien tich la: ',dt:4:2);
end
else writeln(f1,'Day khong la ba canh trong mot tam giac');
close(f1);
readln;
end.
cho em hỏi cái này viết ra thuật toán thì viết kiểu sao ạ
cau 1:
uses crt;
var a:array[1..100] of integer;
n,i,min: integer;
begin
readln(n);
for i:=1 to n do
readln(a[i]);
min:=a[1];
for i:=2 to n do
if min>a[i] then min=a[i];
writeln(a[i]);
readln;
end.
cau 2:
uses crt;
g:text;
s:string;
const fo='CHUSO.TXT';
begin
assign(g,fo);
rewrite(g);
readln(s);
for i:=1 to length(s) do
if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);
writeln(g,s);
end.
uses crt;
const fi='max.out';
var f1:text;
a,b,c,max:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
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;
writeln(f1,max);
close(f1);
readln;
end.