Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (40.68 KB, 2 trang )
<span class='text_page_counter'>(1)</span><div class='page_container' data-page=1>
Bài 5:
a,
For n:=1 to 50 do y:=y+n/(n+1);
b,
a:=1;
b:=1;
e:=1;
n:=1;
while not(a<0.000002) do
begin
for i=1 to n do
b:=b*i;
a:=1/b;
e:=e+a;
n:=n+1;
end;
Bài 6,
for cho:=1 to 19 do
begin
ga:=36-cho;
if ga+2*cho=50 then writeln(‘số gà là=’,ga,’ Số *** là =’,cho);
end;
Bài 7,
Repeat
Writeln(‘Nhập tuổi cha và con’);
Readln(a,b);
Until (a-b>=25) and(a div b>=2) and(a mod b<>0);
While Not(a div b=2) and (a mod b=0) do
Begin
i:=i+1;
a:=a+i;
b:=b+i;
End;
Writeln(‘Sau ’,i,’ năm nữa thì tuổi cha gấp đôi tuổi con’);
Bài 8:
a:=0;
i:=0;
While not(A>=B)do
Begin
a:=a+3*s/100;
s:=s+a;
i:=i+1;
End;
Writeln(‘Sau ’,i,’ tháng thì sẽ đc’,b,’ đồng’);
For i:=3 to n do
d:=a[2]-a[1];
begin
if a [i]-a [i-1]<>d then
begin
kt:=false;
end;
end;
if kt then writeln(‘Là cấp số cộng ’);
Readln
end.
Bài 6:
a,
for i:=1 to n do
begin
if a [i] mod 2=0 then d:=d+1
else d1:=d1+1;
end;
Writeln(‘Số các số lẻ là=’,d2);
Writeln(‘Số các số chẵn là=’d);
b,
for i:=1 to n do
begin
for j:=1 to trunc(sqrt(a[i])) do
begin
if a[i] mod j=0 then
begin
kt:=false;
break;
end;
end;
if kt then d:=d+1;
end;
Writeln(‘Số các số nguyên tố trong dãy là ’d);
Bai 7
Uses crt;
Var x:integer;
kq:longint;
Function F(n:integer):Longint;
begin
if n<=2 then F:=1
Else F:=F(n-2)+F(n-1);
end;
Begin
Clrscr;
Write(#7,'Nhap so n= ');Readln(x);
Write('So Fibonaxi thu ',x,' la ',F(x));
readln;
End.
Bài 10;
For i:=1 to length(s) do
Case a[i] of
‘0’..’9’: d:=d+1;