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:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+1/(2*i+1);
writeln(s:4:2);
readln;
end.
Program bai1;
uses crt;
var n,i: integer;
s:real;
begin
clrscr;
s:=0;
write('nhap n ='); readln(n);
for i:= 1 to n do
s:=s+(2*i-1)/(2*i);
writeln('S = ' ,s :4:2);
readln;
end.
uses crt;
var i,n:integer; S:real;
Begin
clrscr;
write('Nhap n: '); readln(n);
for i:=1 to n do S:=S+1/(i*(i+2));
writeln('Tong la: ',S:3:1);
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 BT_Giai_thua;
USES crt;
VAR i,n:integer; s1:string;
Function Giaithua(x:integer):longint;
Var s,i:longint;
Begin
s:=1;
for i:=1 to x do s:=s*i;
Giaithua:=s;
End;
Function Tong(x:integer):real;
Var j:integer; s:real;
Begin
s:=0;
for j:=1 to x do s:=s+1/Giaithua(j);
Tong:=s;
End;
BEGIN
clrscr;
write('Nhap n:'); readln(n);
writeln(n,'!=', Giaithua(n));
writeln('Tong 1/1!+1/2!+...+1/',n,'! la:',Tong(n):0:2);
str(Giaithua(n),s1);
write('Sau khi xoa duoc:');
i:=length(s1)+1;
repeat
if s1[i-1]='0' then delete(s1,i-1,1)
else break;
i:=i-1;
until i=1 ;
write(s1);
readln;
END.