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)
program hotrotinhoc;
var s: real;
i,n: byte;
function t(x: byte): longint;
var j: byte;
t1: longint;
begin
t1:=1;
for j:=1 to x do
t1:=t1*j;
t1:=t;
end;
begin
readln(n);
s:=0;
for i:=1 to n do
s:=s+1/t(i);
write(s:1:2);
readln
end.
c) Đề em ghi sai rồi thế này với đúng :
\(T=1+\frac{2}{2^2}+\frac{3}{3^2}+\frac{4}{4^2}+...+\frac{n}{n^2}\)
program hotrotinhoc;
var t: real;
n,i: byte;
begin
readln(n);
t:=0;
for i:=1 to n do
t:=t+i/(i*i);
write(t:1:2);
readln
end.
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+1/i;
writeln('tong nghich dao cac so tu 1 toi ',n,' la: ',s:4:2);
readln;
end.
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+1/i;
writeln('tong nghich dao cac so tu 1 toi ',n,' la: ',s:4:2);
readln;
end.
Bài 1:
uses crt;
var n,i,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=0 to n do
if i mod 2=0 then t:=t+a[i];
writeln('Tong cac so chan nho hon hoac bang ',n,' la: ',t);
readln;
end.
Bài 2:
uses crt;
var i,n,dem:integer;
begin
clrscr;
repeat
write('Nhap n=');readln(n);
until n>0;
dem:=0;
for i:=0 to n do
if i mod 3=0 then inc(dem);
writeln('So so chia het cho 3 nho hon hoac bang ',n,' la: ',dem);
readln;
end.
Bài 3:
uses crt;
var a:real;
n,i:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>0;
a:=0;
for i:=1 to n do
a:=a+1/(i*(2*i+1));
writeln('Ket qua la: ',a:4:2);
readln;
end.
Bài 4:
uses crt;
var n,i,kt:integer;
begin
clrscr;
Repeat
write('Nhap n='); readln(n);
Until n>1;
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
readln;
end.
uses crt;
var s:real;
n,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+1/i;
i:=i+2;
end;
writeln('S=',s:4:2);
readln;
end.
a,
var n, i: integer; S: real;
begin
read(n);
while i <= n do
begin
S:=S+i*(i+1);
i:=i+1;
end;
write(S);
end.
b,
var n,i: integer; S: real;
begin
read(n);
while i <= n do
begin
S:=S+2*i;
i:=i+1;
end;
write(S);
end.
c,
var n,i: integer; S: real;
begin
read(n);
while i <=n do
begin
S:=S+(2*i+1);
i:=i+1;
end;
write(S);
end.
T CHỊU
Câu 1:
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 <> 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.
Câu 2:
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 = 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.
Câu 1:
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=1;
for i:=1 to n do
s:=s*i;
writeln(s);
readln;
end.
Câu 2:
uses crt;
var t,i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=1 to n do
t:=t+i;
writeln(t);
readln;
end.
Câu 6:
uses crt;
var n,i:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
if n mod i=0 then write(i:4);
readln;
end.
5:
uses crt;
var n,i,dem:integer;
begin
clrscr;
readln(n);
dem:=0;
for i:=0 to n do
if i mod 2=1 then
begin
write(i:4);
dem:=dem+1;
end;
writeln;
writeln(dem);
readln;
end.
uses crt;
var a,t1,i:integer;
t:real;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=2 to n do
t:=t+1/i;
writeln('T=',t:4:2);
write('Nhap so t='); readln(t1);
a:=0;
for i:=1 to t1 do
a:=a+i;
writeln(a);
readln;
end.
Program bt;
Var n,i: Integer;
T: longint;
Begin
Writeln('Nhap a');
Readln(a);
For i:=2 to n do T=T+1/i;
Writeln(' T=',T);
Readln;
End.