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.
var i,n:integer;
s:real;
begin
s:=1;
write('ban hay nhap vao mot so nguyen: '); readln(n);
for i:= 1 to n do
s:= s + (1/(i*(i+1));
writeln(' tong s = ',s:0:2);
readln
end.
var i,n:integer;
s:real;
begin
s:=1;
write('ban hay nhap vao mot so nguyen: '); readln(n);
for i:= 1 to n do
s:= s + (1/(i*(i+1));
writeln(' tong s = ',s:0:2);
readln
end.
uses crt;
var b:array[1..100] of integer;
i,n,d:integer;
begin
clrscr;
repeat
writeln('nhap n=');readln(n);
until n>0;
for i:=1 to n do
begin writeln('b[',i,']','=');readln(b[i]);end;
writeln('so cac so le la');
for i:=1 to n do
if b[i] mod 2<>0 then d:=d+1;
writeln(d);readln;end.
uses crt;
var n,i:longint; s:real;
begin
clrscr;
s:=0;
writeln('nhap vao n=');readln(n);
writeln('tong cua A la');
for i:=1 to n do
s:=s + 1/(i*(i+2));
writeln(s:4:3);readln;end.
Bài 1:
uses crt;
var a:real;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
a:=0;
i:=1;
while i<=n do
begin
a:=a+1/i;
i:=i+1;
end;
writeln(a:4:2);
readln;
end.
program bai1;
var i,n:longint;s:real;
begin
write('N= ');
readln(n);
s:=1;
for i:=2 to n do s:=s+1/i;
write('s= ',s);
readln
end.
Var i , n : integer;
S: real;
Begin
write (' n ='); read (n);
S:= 0
For i:= 1 to n do S:= S+ 1/i;
Write (S);
Readln;
End.
program bai1;
var s,n,i:longint;
begin
write('N= ');readln(n);
s:=0;
for i:=1 to n do s:=s+1/i;
write('s= ',s);
readln
end.
Bạn tự khai báo nhé!;
Ảnh nhỏ thì nhấn mở hình ảnh trong tab mới nha
4...
begin
repeat
write('N= '):
readln(n);
until n>0;
s:=0;
for i:=1 to n do
s:=s+1/n;
write('s= ',s);
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.
ar s,a:real;
begin
readln(a);
s:=1;
n:=1;
while s <= a do
begin
n:=n+1;
s:=s+1/n;
end;
writeln('So n nho nhat de ',s,' < ',a,' la:',n);
readln;
end.